/// <summary> /// Defines actions to be performed when a button is pressed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Name_Click(object sender, RoutedEventArgs e) { if (!input0 && amount != 3) { string textRange = MyTextBox0.Text; try { BLImp.Validator.GetGoodString(textRange); } catch (ArgumentNullException ex) { MessageBox.Show(ex.Message, "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error); return; } stopName = textRange; MessageBox.Show("input submited " + textRange + " to exit click X", "input", MessageBoxButton.OK, MessageBoxImage.Information); NameLabel.Content = stopName; MyTextBox0.Clear(); if (!input0) { input0 = true; amount++; } } else { MessageBox.Show("wrong input!!!!", "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error); MyTextBox2.Clear(); } }
/// <summary> /// This function is responsible for the process of receiving and checking the input /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Status_Update_Click(object sender, RoutedEventArgs e) { string textRange = MyTextBox2.Text; int result = 0; if (int.TryParse(textRange, out result)) { statusInput = result; try { valid.GoodPositiveStatus(result); } catch (BO.BOBusException) { MessageBox.Show("Wrong status format" + "\n" + "- Click: 0 for a traveling,\n- Click: 1 for a ready for drive, \n- Click: 2 for a treating, \n - Click: 3 for a refuling", " Operation Failure ", MessageBoxButton.OK, MessageBoxImage.Error); MyTextBox2.Clear(); return; } try { bl.UpdateBusStatus(statusInput, managingBus.LicenseNumber); MessageBox.Show("input submited " + result + " to exit click X", "input", MessageBoxButton.OK, MessageBoxImage.Information); MyTextBox2.Clear(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButton.OK, MessageBoxImage.Information); MyTextBox2.Clear(); } } else { MessageBox.Show("wrong input!!!!", "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error); MyTextBox2.Clear(); } }
/// <summary> /// Defines actions to be performed when a button is pressed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Latitude_Click(object sender, RoutedEventArgs e) { string textRange = MyTextBox2.Text; double result = 0; if (double.TryParse(textRange, out result)) { try { valid.GetGoodLatitude(result); } catch (ArgumentOutOfRangeException ex) { MessageBox.Show(ex.Message, "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error); MyTextBox2.Clear(); return; } if (!input2 && amount != 3) { amount++; latitude = result; MessageBox.Show("input submited " + result + " to exit click X", "input", MessageBoxButton.OK, MessageBoxImage.Information); LatitudeLabel.Content = result; MyTextBox2.Clear(); if (!input2) { input2 = true; } } } else { MessageBox.Show("wrong input!!!!", "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error); MyTextBox2.Clear(); } }
/// <summary> /// This function is responsible for the process of receiving and checking the input /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Latitude_Click(object sender, RoutedEventArgs e) { string textRange = MyTextBox2.Text; double result = 0; if (double.TryParse(textRange, out result)) { try { valid.GetGoodLatitude(result); } catch (ArgumentOutOfRangeException ex) { MessageBox.Show(ex.Message, "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error); MyTextBox2.Clear(); return; } latitude = result; try { bl.UpdateStopLatitude(result, managingStop.StopCode); MessageBox.Show("input submited" + result + " to exit click X", "input", MessageBoxButton.OK, MessageBoxImage.Information); MyTextBox2.Clear(); } catch (BO.BODOStopBadIdException ex) { MessageBox.Show(ex.Message, "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error); MyTextBox1.Clear(); return; } } else { MessageBox.Show("wrong input!!!!", "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error); MyTextBox2.Clear(); } }
/// <summary> /// This function is responsible for the series of actions that will be performed when this button is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Travel_Click(object sender, RoutedEventArgs e) { string textRange = MyTextBox2.Text; float result = 0; if (float.TryParse(textRange, out result)) { try { valid.GoodPositiveflout(result); } catch (BO.BOBusException) { MessageBox.Show("negative number", "Operation Failure", MessageBoxButton.OK, MessageBoxImage.Error); MyTextBox2.Clear(); return; } if (amount != 5) { MessageBox.Show("input submited " + result + " to exit click X", "input", MessageBoxButton.OK, MessageBoxImage.Information); KMLabel.Content = result; kM = result; MyTextBox2.Clear(); if (!input2) { input2 = true; amount++; } } } else { MessageBox.Show("wrong input!!!", " Operation Failure ", MessageBoxButton.OK, MessageBoxImage.Error); MyTextBox2.Clear(); } }