private void OnDeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate deviceInformationUpdate) { if (Disconnected != null) { Disconnected(); } }
private static void HandleDeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate args) { var gamepad = _gamepads[args.Id]; _gamepads.Remove(args.Id); GamepadRemoved?.Invoke(sender, gamepad); }
private void DeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate args) { if (ExternalDeviceRemoved != null) { ExternalDeviceRemoved(this, args.Id); } }
private async void DevicesRemoved(DeviceWatcher sender, DeviceInformationUpdate args) { //Debug.WriteLine("Removed USB device: " + args.Id); await dispatcher.RunAsync(CoreDispatcherPriority.Low, () => { UpdateDevices(); }); }
/// <summary> /// Invoked when the device watcher detects that the proximity sensor was removed. /// </summary> /// <param name="sender">The device watcher.</param> /// <param name="device">The device that was removed.</param> private void OnProximitySensorRemoved(DeviceWatcher sender, DeviceInformationUpdate device) { if ((this.proximitySensor != null) && (this.proximitySensor.DeviceId == device.Id)) { this.proximitySensor.ReadingChanged -= ProximitySensor_ReadingChangedAsync; this.proximitySensor = null; SetActive(false); } }
private async void DeviceWatcher_Removed(DeviceWatcher sender, DeviceInformationUpdate args) { await coreDispatcher.RunAsync( CoreDispatcherPriority.Normal, () => { for (int index = 0; index < FoundDeviceList.Count; ++index) { if (FoundDeviceList[index].Id == args.Id) { FoundDeviceList.RemoveAt(index); break; } } }); }
private void SerialPortWatcher_Removed(DeviceWatcher sender, DeviceInformationUpdate args) { isPortReady = false; try { dataWriter.Dispose(); dataReader.Dispose(); serialPort.Dispose(); } catch { } dataWriter = null; dataReader = null; serialPort = null; frameReaderTask = null; SerialPortConnectionChanged?.Invoke(this, null); }
private static void HandleDeviceUpdated(DeviceWatcher sender, DeviceInformationUpdate args) => _devices[args.Id]._deviceInformation.Update(args);
public void Update(DeviceInformationUpdate deviceInfoUpdate) { deviceInfo.Update(deviceInfoUpdate); OnPropertyChanged("Kind"); OnPropertyChanged("Id"); OnPropertyChanged("Name"); OnPropertyChanged("DeviceInformation"); OnPropertyChanged("CanPair"); OnPropertyChanged("IsPaired"); OnPropertyChanged("DevicePairingStateText"); OnPropertyChanged("PairButtonVisiblilty"); OnPropertyChanged("UnpairButtonVisiblilty"); UpdateGlyphBitmapImage(); }
/// <summary> /// Update UI on device updated /// </summary> /// <param name="sender">The active DeviceWatcher instance</param> /// <param name="args">Event arguments</param> private async void DeviceWatcher_Updated(DeviceWatcher sender, DeviceInformationUpdate args) { // If all devices have been enumerated if (this.enumerationCompleted) { await coreDispatcher.RunAsync(CoreDispatcherPriority.High, () => { // Update the device list UpdateDevices(); }); } }
private void DeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate args) { LogMessage("Device Removed Id: " + args.Id); }
private void Provider_WatchUpdated(object sender, DeviceInformationUpdate e) => Updated?.Invoke(this, e);
private void DeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate args) { ExternalDeviceRemoved?.Invoke(this, args.Id); }
public void Update(DeviceInformationUpdate deviceInfoUpdate) { deviceInfo.Update(deviceInfoUpdate); UpdateGlyphBitmapImage(); }
private async void Watcher_Removed(DeviceWatcher sender, DeviceInformationUpdate args) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { //Remove any removed devices from our listbox foreach (CastingDevice currentDevice in castingDevicesList.Items) { if (currentDevice.Id == args.Id) { castingDevicesList.Items.Remove(currentDevice); break; } } }); }
private void watcher_Removed(Windows.Devices.Enumeration.DeviceWatcher sender, Windows.Devices.Enumeration.DeviceInformationUpdate args) { Debug.WriteLine(args.Id); this.BeginInvoke((Action)(() => { //perform on the UI thread PrintDrives(); })); }
/// <summary> /// Event handler for the removal of a scanner device /// </summary> /// <param name="sender"></param> /// <param name="deviceInfo">The device info for the device which was added</param> private async void OnScannerRemoved(DeviceWatcher sender, DeviceInformationUpdate deviceInfo) { await MainPage.Current.Dispatcher.RunAsync( Windows.UI.Core.CoreDispatcherPriority.Normal, () => { var deviceId = deviceInfo.Id; MainPage.Current.NotifyUser(String.Format("Scanner with device id {0} has been removed", deviceId), NotifyType.StatusMessage); // Search the list of devices for one with a matching device id var match = FindInList(deviceId); if (match != null) { // Remove the matched item MainPage.Current.NotifyUser(String.Format("Scanner with device id {0} has been removed from list", deviceId), NotifyType.StatusMessage); scannerInfoList.Remove(match); } } ); }
private async void OnDeviceUpdated(DeviceWatcher deviceWatcher, DeviceInformationUpdate deviceInfoUpdate) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { _discoveryRWLock.EnterWriteLock(); for (int idx = 0; idx < _discoveredDevices.Count; idx++) { DiscoveredDevice devInfodisplay = _discoveredDevices[idx]; if (devInfodisplay.DeviceInfo.Id == deviceInfoUpdate.Id) { devInfodisplay.DeviceInfo.Update(deviceInfoUpdate); break; } } }); }
private async void OnDeviceRemoved(DeviceWatcher deviceWatcher, DeviceInformationUpdate deviceInfoUpdate) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { _discoveryRWLock.EnterWriteLock(); foreach (DiscoveredDevice devInfodisplay in _discoveredDevices) { if (devInfodisplay.DeviceInfo.Id == deviceInfoUpdate.Id) { _discoveredDevices.Remove(devInfodisplay); break; } } _discoveryRWLock.ExitWriteLock(); }); }
private static void HandleDeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate args) { var device = _devices[args.Id]; _devices.Remove(args.Id); DeviceRemoved?.Invoke(sender, device); }
public void UpdateDeviceInfo(DeviceInformationUpdate update) { DeviceInfo.Update(update); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("DisplayName")); }
private async void DeviceWatcher_Removed(DeviceWatcher sender, DeviceInformationUpdate deviceInfoUpdate) { // We must update the collection on the UI thread because the collection is databound to a UI element. await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { // Protect against race condition if the task runs after the app stopped the deviceWatcher. if (sender == deviceWatcher) { // Find the corresponding DeviceInformation in the collection and remove it. BluetoothLEDeviceDisplay bleDeviceDisplay = FindBluetoothLEDeviceDisplay(deviceInfoUpdate.Id); if (bleDeviceDisplay != null) { ResultCollection.Remove(bleDeviceDisplay); } } }); }
/// <summary> /// We will remove the device from the UI /// </summary> /// <param name="sender"></param> /// <param name="deviceInformationUpdate"></param> private async void OnDeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate deviceInformationUpdate) { await rootPage.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, new DispatchedHandler(() => { rootPage.NotifyUser("Device removed - " + deviceInformationUpdate.Id, NotifyType.StatusMessage); RemoveDeviceFromList(deviceInformationUpdate.Id); })); }
public void Update(DeviceInformationUpdate deviceInfoUpdate) { DeviceInformation.Update(deviceInfoUpdate); OnPropertyChanged("Id"); OnPropertyChanged("Name"); OnPropertyChanged("DeviceInformation"); OnPropertyChanged("IsPaired"); OnPropertyChanged("IsConnected"); OnPropertyChanged("Properties"); UpdateGlyphBitmapImage(); }
public void Update(DeviceInformationUpdate deviceInfoUpdate) { deviceInfo.Update(deviceInfoUpdate); OnPropertyChanged("Kind"); OnPropertyChanged("Id"); OnPropertyChanged("Name"); OnPropertyChanged("DeviceInformation"); OnPropertyChanged("CanPair"); OnPropertyChanged("IsPaired"); UpdateGlyphBitmapImage(); }
/// <summary> /// Invoked when the device watcher detects that the activity sensor was removed. /// </summary> /// <param name="sender">The device watcher.</param> /// <param name="device">The device that was removed.</param> private void OnActivitySensorRemoved(DeviceWatcher sender, DeviceInformationUpdate device) { if ((this.activitySensor != null) && (this.activitySensor.DeviceId == device.Id)) { this.activitySensor.ReadingChanged -= ActivitySensor_ReadingChangedAsync; this.deviceAccessInformation.AccessChanged -= DeviceAccessInfo_AccessChangedAsync; this.activitySensor = null; SetActive(false); } }
private async void OnVideoDeviceWatcher_Removed(DeviceWatcher sender, DeviceInformationUpdate args) { await UpdateIsCameraAvailableAsync().ConfigureAwait(false); }
private void OnDeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate update) { lock (this.devices) { this.devices.Remove(update.Id); if (this.devices.Count == 0) this.isCameraAvailable = false; } }
private async void DeviceWatcher_Removed(DeviceWatcher sender, DeviceInformationUpdate args) => await this.ClearAudioFilesAsync();
private void OnDeviceUpdated(DeviceWatcher sender, DeviceInformationUpdate update) { object value; if (!update.Properties.TryGetValue("System.Devices.InterfaceEnabled", out value)) return; lock (this.devices) { if ((bool)value) this.devices.Add(update.Id); else this.devices.Remove(update.Id); this.isCameraAvailable = this.devices.Count > 0; } }
private void Watcher_Updated(Windows.Devices.Enumeration.DeviceWatcher sender, Windows.Devices.Enumeration.DeviceInformationUpdate args) { }
/// <summary> /// Close the device that is opened so that all pending operations are canceled properly. /// </summary> /// <param name="sender"></param> /// <param name="deviceInformationUpdate"></param> private void OnDeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate deviceInformationUpdate) { if (IsDeviceConnected && (deviceInformationUpdate.Id == deviceInformation.Id)) { // The main reasons to close the device explicitly is to clean up resources, to properly handle errors, // and stop talking to the disconnected device. CloseCurrentlyConnectedDevice(); } }
private async void OnAudioDeviceWatcher_Removed(DeviceWatcher sender, DeviceInformationUpdate args) { await UpdateIsMicrophoneAvailableAsync().ConfigureAwait(false); }