/// <summary> /// Sets the message in the ACK received event and fires the event /// </summary> /// <param name="message">The message in the ACK received event</param> /// <param name="originalMessage">The original message received from the board</param> private void SetArgsAndFireEvent(string message, string originalMessage) { AckReceivedEventArgs args = new AckReceivedEventArgs(); args.Ack = message; args.originalACK = originalMessage; OnACKReceived(args); }
/// <summary> /// This method is needed to handle Ack received events /// </summary> /// <param name="e"></param> protected virtual void OnACKReceived(AckReceivedEventArgs e) { EventHandler <AckReceivedEventArgs> handler = ackReceived; if (handler != null) { handler(this, e); } }
/// <summary> /// When an ACK is received through the serial port, an automatically closing messagebox is shown with the received ACK. /// </summary> /// <param name="sender"></param> /// <param name="a"></param> void HandleReceivedACK(object sender, AckReceivedEventArgs a) { //TODO change to select the wanted MessageBox MessageBox.Show(a.Ack); //AutoClosingMessageBox.Show(a.Ack, "Received Message from port", closeAfterMillis); // If volume setting failed, reset the trackbar value if (a.Ack == System.Configuration.ConfigurationManager.AppSettings["timeSetNOK"]) { trackBar1.Value = previousVolumeValue; } // Show original message from board in textbox this.Invoke(new MethodInvoker(delegate() { textBox2.Text = a.originalACK; })); }