// ReSharper disable InconsistentNaming private void MMNotificationClientOnDeviceStateChanged(object sender, DeviceStateChangedEventArgs e) // ReSharper restore InconsistentNaming { if (e.DeviceState == DeviceState.Active) { Application.Current.Dispatcher.BeginInvoke(new Action(() => AddDevice(e.DeviceId))); } else if (e.DeviceState != DeviceState.Active) { Application.Current.Dispatcher.BeginInvoke(new Action(() => RemoveDevice(e.DeviceId))); } }
void _mmNotificationClient_DeviceStateChanged(object sender, DeviceStateChangedEventArgs e) { if (e.DeviceState == DeviceState.Active) { Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => AddDevice(e.DeviceID))); } else if (e.DeviceState != DeviceState.Active) { Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => RemoveDevice(e.DeviceID))); } }