Пример #1
0
 //3.  Raise Event - using the statement RaisEvent+name of the event
 public void OnChangeRoute(ChangeRouteEventArgs e)
 {
     if (SendChangeCourseEvent != null)
     {
         SendChangeCourseEvent(this, e);
     }
 }
Пример #2
0
        /// <summary>
        /// Method provides behavior for route change on comboBox.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmbStatus_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int item = cmbStatus.SelectedIndex;

            try
            {
                switch (item)
                {
                case -1: MessageBox.Show("This is the selection is empty");
                    break;

                case 0:
                    NavCourse  = "0 Degrees";
                    FlightCode = this.FlightCode;
                    Time       = DateTime.Now.ToString();
                    //Onxxx handler recurring in this switch statement
                    ChangeRouteEventArgs changeRouteEvent = new ChangeRouteEventArgs(FlightCode, NavCourse, DateTime.Now.ToString());
                    OnChangeRoute(changeRouteEvent);
                    break;

                case 1:
                    NavCourse  = "90 Degrees";
                    FlightCode = this.FlightCode;
                    Time       = DateTime.Now.ToString();

                    changeRouteEvent = new ChangeRouteEventArgs(FlightCode, NavCourse, DateTime.Now.ToString());
                    OnChangeRoute(changeRouteEvent);
                    break;

                case 2:
                    NavCourse  = "180 Degrees";
                    FlightCode = this.FlightCode;
                    Time       = DateTime.Now.ToString();

                    changeRouteEvent = new ChangeRouteEventArgs(FlightCode, NavCourse, DateTime.Now.ToString());
                    OnChangeRoute(changeRouteEvent);
                    break;

                case 3:
                    NavCourse  = "270 Degrees";
                    FlightCode = this.FlightCode;
                    Time       = DateTime.Now.ToString();

                    changeRouteEvent = new ChangeRouteEventArgs(FlightCode, NavCourse, DateTime.Now.ToString());
                    OnChangeRoute(changeRouteEvent);
                    break;
                }
            }
            catch
            {
                MessageBox.Show("Error");
            }
        }//end method
Пример #3
0
 /// <summary>
 /// Method handles the output for the change of route
 /// </summary>
 /// <param name="source"></param>
 /// <param name="e"></param>
 public void OutputChangeRoute(object source, ChangeRouteEventArgs e)
 {
     lvFlights.Items.Add(new { FlightCode = e.FlightNo, Status = e.Course, Time = e.FlightTime });
 }