using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace WpfApp1 { /// /// Логика взаимодействия для Page1.xaml /// public partial class Page1 : Page { public Page1() { InitializeComponent(); } private void CalculateButton_Click(object sender, RoutedEventArgs e) { if (double.TryParse(AngleTextBox.Text, out double angle) && double.TryParse(TimeTextBox.Text, out double time)) { angle = angle * Math.PI / 180; double acceleration = 9.8 * Math.Sin(angle); double distance = 0.5 * acceleration * time * time; ResultLabel.Content = $"Пройденное расстояние: {distance} м"; } else { MessageBox.Show("Пожалуйста, введите числовые значения.", "Ошибка ввода!", MessageBoxButton.OK, MessageBoxImage.Error); } } private void Button_Click(object sender, RoutedEventArgs e) { AngleTextBox.Text = string.Empty; TimeTextBox.Text = string.Empty; ResultLabel.Content = string.Empty; } } }