示例#1
0
 /// <summary>
 /// Casts ReceiveStatus events coming from a different thread to the UI thread when necessary.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="StatusEventArgs" /> instance containing the device status.</param>
 /// <exception cref="System.NullReferenceException">Platform not set.</exception>
 private void _comm_ReceiveStatus(object sender, StatusEventArgs e)
 {
     if (_platform == null)
     {
         throw new NullReferenceException("Platform not set.");
     }
     if (_platform.InvokeIfRequired(new StatusEventHandler(_comm_ReceiveStatus), sender, e)) //Recast event to UI thread when necessary
     {
         return;
     }
     ReceiveStatus?.Invoke(this, e);
 }