private void RefreshBut_Click(object sender, RoutedEventArgs e) { Imitation.StopImitation(); Statistics.GetInstance.Clear(); RoadCanvas.Children.Clear(); pause = false; StartButton.IsEnabled = true; StatTextBox.Text = ""; }
private void StartBut_Click(object sender, RoutedEventArgs e) { StartButton.IsEnabled = false; if (!pause) { pause = true; bool unlimit; unlimit = Convert.ToBoolean(checkImitTime.IsChecked); try { Settings.UpdateSettings(Convert.ToInt32(minSpeed.Text), Convert.ToInt32(maxSpeed.Text), Convert.ToDouble(Interval.Text), Convert.ToInt32(imitTime.Text), unlimit, Convert.ToDouble(KeepDistance_TextBox.Text)); minSpeed.Text = Convert.ToString(Settings.MinSpeed); maxSpeed.Text = Convert.ToString(Settings.MaxSpeed); Interval.Text = Convert.ToString(Settings.Interval); Imitation.SetParameters(RoadCanvas, StatTextBox); Imitation.StartImitation(); } catch (Exception) { MessageBox.Show("Invalid input parameters"); StartButton.IsEnabled = true; Imitation.StopImitation(); Statistics.GetInstance.Clear(); RoadCanvas.Children.Clear(); pause = false; StartButton.IsEnabled = true; StatTextBox.Text = ""; } } else { Imitation.StartImitation(); } }
private void StopBut_Click(object sender, RoutedEventArgs e) { Imitation.StopImitation(); StartButton.IsEnabled = true; }