//3. Raise Event - using the statement RaisEvent+name of the event public void OnSendTakeOff(TakeOffEventArgs e) { if (SendTakeOffEvent != null) { SendTakeOffEvent(this, e); } }
/// <summary> /// Method provides event handler for the start button /// </summary> /// <param name="sender"></param> /// <param name="e"></param>+- private void btnStart_Click(object sender, RoutedEventArgs e) { cmbStatus.IsEnabled = true; btnLand.IsEnabled = true; btnStart.IsEnabled = false; TakeOffEventArgs takeOfArgs = new TakeOffEventArgs(FlightCode, NavCourse, DateTime.Now.ToString()); OnSendTakeOff(takeOfArgs); MessageBox.Show("Flight No is:" + FlightCode); }
/// <summary> /// Method handles the Output for the takeoff /// </summary> /// <param name="source"></param> /// <param name="e"></param> public void OutputTakeOff(object source, TakeOffEventArgs e) { lvFlights.Items.Add(new { FlightCode = e.FlightCode, Status = e.FlightStatus, Time = e.FlightTime }); }