/// <summary> /// an event that opens the add window /// </summary> private void Add_Click(object sender, RoutedEventArgs e) { AddTrip trip = new AddTrip(true, isBus, Index); if (trip.ShowDialog() == true) { trips.Add(trip.MyTrip); bl.AddBusOnTrip(trip.MyTrip); busTrips.ItemsSource = trips; } }
/// <summary> /// an event that opens the updade window /// </summary> private void Update_Click(object sender, RoutedEventArgs e) { BO.BusOnTrip b = ((Button)sender).DataContext as BO.BusOnTrip; AddTrip upTrip = new AddTrip(false, true, Index, b); if (upTrip.ShowDialog() == true) { bl.UpdateBusOnTrip(b); int i = trips.IndexOf(b); trips.Remove(b); trips.Insert(i, b); busTrips.ItemsSource = trips; } }