示例#1
0
 /// <summary>
 /// Casts StateChanged events coming from a different thread to the UI thread when necessary.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="CurrentState">State of the current.</param>
 /// <exception cref="System.NullReferenceException">Platform not set.</exception>
 private void _comm_StateChanged(object sender, CommManager.DeviceState CurrentState)
 {
     if (_platform == null)
     {
         throw new NullReferenceException("Platform not set.");
     }
     if (_platform.InvokeIfRequired(new CommManager.StatusChangedEventHandler(_comm_StateChanged), sender, CurrentState)) //Recast event to UI thread when necessary
     {
         return;
     }
     StateChanged?.Invoke(this, CurrentState);
 }
示例#2
0
 /// <summary>
 /// Casts StateChanged events coming from a different thread to the UI thread when necessary.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">State of the current.</param>
 /// <exception cref="System.NullReferenceException">Platform not set.</exception>
 private async Task _comm_StateChangedAsync(object sender, CommManager.DeviceState e)
 {
     _comm_StateChanged(sender, e);
 }