Inheritance: IDeviceInformationUpdate
Ejemplo n.º 1
0
 private void OnDeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate deviceInformationUpdate)
 {
     if (Disconnected != null)
     {
         Disconnected();
     }
 }
Ejemplo n.º 2
0
        private static void HandleDeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate args)
        {
            var gamepad = _gamepads[args.Id];

            _gamepads.Remove(args.Id);
            GamepadRemoved?.Invoke(sender, gamepad);
        }
Ejemplo n.º 3
0
 private void DeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate args)
 {
     if (ExternalDeviceRemoved != null)
     {
         ExternalDeviceRemoved(this, args.Id);
     }
 }
Ejemplo n.º 4
0
    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;
                 }
             }
         });
 }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
 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();
         });
     }
 }
Ejemplo n.º 11
0
 private void DeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate args)
 {
     LogMessage("Device Removed Id: " + args.Id);
 }
Ejemplo n.º 12
0
 private void Provider_WatchUpdated(object sender, DeviceInformationUpdate e) =>
 Updated?.Invoke(this, e);
Ejemplo n.º 13
0
 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;
             }
         }
     });
 }
Ejemplo n.º 16
0
 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();
            });
        }
Ejemplo n.º 20
0
        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);
            }
        }
Ejemplo n.º 27
0
		private async void OnVideoDeviceWatcher_Removed(DeviceWatcher sender, DeviceInformationUpdate args)
		{
			await UpdateIsCameraAvailableAsync().ConfigureAwait(false);
		}
Ejemplo n.º 28
0
 private void OnDeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate update)
 {
   lock (this.devices)
   {
     this.devices.Remove(update.Id);
     if (this.devices.Count == 0)
       this.isCameraAvailable = false;
   }
 }
Ejemplo n.º 29
0
 private async void DeviceWatcher_Removed(DeviceWatcher sender, DeviceInformationUpdate args)
      => await this.ClearAudioFilesAsync();
Ejemplo n.º 30
0
    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;
      }
    }
Ejemplo n.º 31
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();
     }
 }
Ejemplo n.º 33
0
		private async void OnAudioDeviceWatcher_Removed(DeviceWatcher sender, DeviceInformationUpdate args)
		{
			await UpdateIsMicrophoneAvailableAsync().ConfigureAwait(false);
		}