Esempio n. 1
0
 private void btUpdate_Click(object sender, EventArgs e)
 {
     if (selectedAirplane != null)
     {
         selectedAirplane.ChangeFuel(Convert.ToInt32(nUDChangeFuel.Value));
         selectedAirplane.ChangeSpeed(Convert.ToInt32(nUDChangeSpeed.Value));
         string destination = cbChangeDestination.Text;
         if (!destination.ToUpper().Equals(selectedAirplane.Flight.DestinationAirport.Name.ToUpper()))
         {
             bool found = false;
             foreach (Airport a in airNetwork.Airports)
             {
                 if (a.Name.ToUpper() == destination.ToUpper())
                 {
                     selectedAirplane.ChangeRoute(selectedAirplane.CurrentLocation, a);
                     found = true;
                 }
             }
             if (!found)
             {
                 MessageBox.Show("No such airport was found. Please enter another one");
             }
         }
     }
 }