Esempio n. 1
0
 private void backgroundSerial_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         iSerial.Flush();
         MissedCommunication += 1;
         OnMissedCommunicationChanged();
         //MessageBox.Show(e.Error.Message);
     }
     else if (e.Cancelled)
     {
         // Next, handle the case where the user canceled
         // the operation.
         // Note that due to a race condition in
         // the DoWork event handler, the Cancelled
         // flag may not have been set, even though
         // CancelAsync was called.
         MessageBox.Show("Canceled");
     }
     else
     {
         iSerial.HandleByte(e.Result as byte[]);
     }
 }