Ejemplo n.º 1
0
 /// <summary
 ///     If the event ChangedRoute is being triggered it sends info to the ListView and show the information there
 /// </summary>
 private void OnChangedRoute(object sender, FlightInfo e)
 {
     dynamic strOut = string.Format("\t{0,-40} {1,-40} {2,20}", e.SetFlight, e.SetStatus, e.SetTime);
     ListView.Items.Add(strOut);
 }
Ejemplo n.º 2
0
 /// <summary
 ///     Click event, enables and disables buttons and sends information about the flight started to listview later
 /// </summary>
 private void startButton_Click(object sender, RoutedEventArgs e)
 {
     startButton.IsEnabled = false;
     landButton.IsEnabled = true;
     changeRouteBox.IsEnabled = true;
     string time = DateTime.Now.ToLongTimeString() + ", " + DateTime.Now.ToShortDateString();
     //Sets the flightinfo
     FlightInfo flightInfo = new FlightInfo(this.Title, time, "Started");
     OnFlightStart(flightInfo);
 }
Ejemplo n.º 3
0
 /// <summary
 ///     Constructor with flightInfo object as parameter
 /// </summary>
 public ControlTowerWindow(FlightInfo flightInfo)
 {
     InitializeComponent();
     newFlight = flightInfo;
 }
Ejemplo n.º 4
0
 /// <summary
 ///     Checks if flightLanded isn't null, if not it sends event
 /// </summary>
 private void OnFlightLand(FlightInfo e)
 {
     if (FlightLanded != null)
     {
         FlightLanded(this, e);
     }
 }
Ejemplo n.º 5
0
 /// <summary
 ///     Checks if ChangedRoute isn't null, if not it sends event
 /// </summary>
 private void OnChangedRoute(FlightInfo e)
 {
     if (ChangedRoute != null)
     {
         ChangedRoute(this, e);
     }
 }
Ejemplo n.º 6
0
 /// <summary
 ///     Same as before, but this time while clicking "Land"
 /// </summary>
 private void landButton_Click(object sender, RoutedEventArgs e)
 {
     landButton.IsEnabled = false;
     changeRouteBox.IsEnabled = false;
     string time = DateTime.Now.ToShortDateString() + ", " + DateTime.Now.ToLongTimeString();
     FlightInfo flightInfo = new FlightInfo(this.Title, time, "Landed");
     OnFlightLand(flightInfo);
     this.Close();
 }
Ejemplo n.º 7
0
 /// <summary
 ///     Sends the degree chosen in the ComboBox besides same as before
 /// </summary>
 private void changeRouteBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     string time = DateTime.Now.ToLongTimeString() + ", " + DateTime.Now.ToShortDateString();
     string deg = ((String)((ComboBoxItem)changeRouteBox.SelectedItem).Content);
     FlightInfo flightInfo = new FlightInfo(this.Title, time, "Now heading: " + deg);
     OnChangedRoute(flightInfo);
 }
Ejemplo n.º 8
0
 /// <summary
 ///     Checks if flightStarted isn't null, if not it sends event
 /// </summary>
 public void OnFlightStart(FlightInfo e)
 {
     if (FlightStarted != null)
     {
         FlightStarted(this, e);
     }
 }