private void BtnEdit_Click(object sender, RoutedEventArgs e) { Flight selectedFlight = DGFlights.SelectedItem as Flight; if (SelectedFlight(selectedFlight)) { Flight oldFlight = selectedFlight.Clone() as Flight; EditFlightsWindow efw = new EditFlightsWindow(selectedFlight, EditFlightsWindow.Option.EDIT); if (efw.ShowDialog() != true) { int index = IndexOfSelectedFlight(oldFlight.FlightNumber); Data.Instance.Flights[index] = oldFlight; } else { selectedFlight.ChangeFlight(); } } }
private void BtnAdd_Click(object sender, RoutedEventArgs e) { EditFlightsWindow efw = new EditFlightsWindow(new Flight(), EditFlightsWindow.Option.ADDING); efw.ShowDialog(); }