/// <summary> /// Initializes the current window in all existing objects /// </summary> public PresentationLines(string auInput) { InitializeComponent(); bl = BLApi.Factory.GetBL("1"); a = bl.GetAllLines().ToList(); au = auInput; if (au == "PASSENGER") { AddButton.Visibility = Visibility.Collapsed; foreach (BO.Line line in a) { line.Show = BO.status.REFULING; } } else { foreach (BO.Line line in a) { line.Show = BO.status.READY_FOR_DRIVE; } } lineList.ItemsSource = a; lineOptions.Items.Add("TRAVELING"); lineOptions.Items.Add("NOT_TRAVELING"); }
/// <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(); }