/// <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 Delete_Click(object sender, RoutedEventArgs e) { Button a = (Button)sender; tempStop = (BO.Stop)a.DataContext; try { bl.DeleteStop(tempStop.StopCode); } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButton.OK, MessageBoxImage.Information); } var aa = bl.GetAllStops().ToList(); if (au == "PASSENGER") { foreach (BO.Stop stop in aa) { stop.Show = BO.status.REFULING; } } else { foreach (BO.Stop stop in aa) { stop.Show = BO.status.READY_FOR_DRIVE; } } stopList.ItemsSource = aa; }