/// <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; tempLine = (BO.Line)a.DataContext; try { bl.DeleteLine(tempLine.Id); } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButton.OK, MessageBoxImage.Information); } var aa = bl.GetAllLines().ToList(); if (au == "PASSENGER") { foreach (BO.Line line in aa) { line.Show = BO.status.REFULING; } } else { foreach (BO.Line line in aa) { line.Show = BO.status.READY_FOR_DRIVE; } } lineList.ItemsSource = aa; lineList.Items.Refresh(); }