/// <summary> /// Event handler for the removal of an device /// </summary> /// <param name="sender"></param> /// <param name="devInformation">The device interface that was removed</param> private void OnRemoved(Windows.Devices.Enumeration.DeviceWatcher sender, Windows.Devices.Enumeration.DeviceInformationUpdate devInformation) { var deviceId = devInformation.Id; // Search the list of devices for one with a matching ID var match = FindInList(deviceId); if (match != null) { // Remove the matched item this.devices.Remove(match); DeviceRemoved(this, new UsbDeviceInfo(match)); } }
/// <summary> /// Event handler for the removal of an Fx2 device /// </summary> /// <param name="sender"></param> /// <param name="devInformation">The device interface that was removed</param> private async void OnFx2Removed(Windows.Devices.Enumeration.DeviceWatcher sender, Windows.Devices.Enumeration.DeviceInformationUpdate devInformation) { await MainPage.Current.Dispatcher.RunAsync( Windows.UI.Core.CoreDispatcherPriority.Normal, () => { var deviceId = devInformation.Id; MainPage.Current.NotifyUser(String.Format("OnFx2Removed: {0}", deviceId), NotifyType.StatusMessage); // Search the list of devices for one with a matching ID var match = FindInList(deviceId); if (match != null) { // Remove the matched item MainPage.Current.NotifyUser(String.Format("OnFx2Removed: {0} removed", deviceId), NotifyType.StatusMessage); m_Fx2Devices.Remove(match); } } ); }
private void ShadowDriverDeviceWatcher_Removed(Windows.Devices.Enumeration.DeviceWatcher sender, Windows.Devices.Enumeration.DeviceInformationUpdate args) { ShadowDriverDevice = null; ViewModel.DeviceConnectStatus = "Disconnected"; }