/// <summary> /// Defines actions to be performed when a button is pressed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Delete_Click(object sender, RoutedEventArgs e) { Button a = (Button)sender; tempBus = (BO.Bus)a.DataContext; bl.DeleteBus(tempBus.LicenseNumber); var aa = bl.GetAllBusses().ToList(); if (au == "PASSENGER") { foreach (BO.Bus bus in aa) { bus.Show = BO.status.REFULING; } } else { foreach (BO.Bus bus in aa) { bus.Show = BO.status.READY_FOR_DRIVE; } } busList.DataContext = aa; busList.Items.Refresh(); }
/// <summary> /// Initializes the current window in all existing objects /// </summary> public PresentationBusses(string auInput) { InitializeComponent(); bl = BLApi.Factory.GetBL("1"); a = bl.GetAllBusses().ToList(); busOptions.Items.Add("TRAVELING"); busOptions.Items.Add("READY_FOR_DRIVE"); busOptions.Items.Add("TREATING"); busOptions.Items.Add("REFULING"); au = auInput; if (au == "PASSENGER") { AddButton.Visibility = Visibility.Collapsed; foreach (BO.Bus bus in a) { bus.Show = BO.status.REFULING; } } else { foreach (BO.Bus bus in a) { bus.Show = BO.status.READY_FOR_DRIVE; } } DataContext = this; busList.DataContext = a; }