public void RemoveFlight(Flight flight) { if (seatList.Count == MaxPassengerCount) { availableFlights.Remove(flight); } }
public SeatReservationPage() { InitializeComponent(); plane1 = new Aircraft(20, 1000, true); mp = new MainPage(); f = new Flight(); Loaded += SeatReservationPage_Loaded; }
public void Refuel(Flight flight) { _aircraft.MaintenanceStatus = false; RemoveFlight(flight); Thread.Sleep(7000); _aircraft.MaintenanceStatus = true; AddFlight(flight); }
private void SubmitButton_Click(object sender, RoutedEventArgs e) { InputBox.Visibility = Visibility.Collapsed; string input = InputNameBox.Text; Flight _addpassenger = new Flight(); int value = seatList.SelectedIndex + 1; _addpassenger.AddPassenger(value, input); _addpassenger.WriteToFile(@"Flight7501_PassengerManifest.txt"); MessageBox.Show("Your seat is reserved!"); seatList.Items.RemoveAt(value-1); InputNameBox.Text = string.Empty; }
private void MainPage_Loaded(object sender, RoutedEventArgs e) { flight1 = new Flight(7501, "Milwaukee", "Boston", "8:15am", "2/15/16"); flight2 = new Flight(8405, "Milwaukee", "Las Vegas", "10:40am", "3/16/2016"); flight3 = new Flight(5423, "Milwaukee", "Orlando", "10:15pm", "3/25/2016"); availableFlights.Add(flight1); availableFlights.Add(flight2); availableFlights.Add(flight3); foreach (Flight flight in availableFlights) { flightList.Items.Add(flight.ToString()); } }
public void AddFlight(Flight flight) { availableFlights.Add(flight); }