/// <summary> /// DsHidMini device connected. /// </summary> /// <param name="obj">The device path.</param> private void ListenerOnDeviceArrived(string obj) { _vm.Devices.Clear(); var instance = 0; while (Devcon.Find(DsHidMiniDriver.DeviceInterfaceGuid, out var path, out var instanceId, instance++)) { _vm.Devices.Add(new DeviceViewModel(PnPDevice.GetDeviceByInstanceId(instanceId))); } }
protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); var instance = 0; while (Devcon.Find(DsHidMiniDriver.DeviceInterfaceGuid, out var path, out var instanceId, instance++)) { _vm.Devices.Add(new DeviceViewModel(PnPDevice.GetDeviceByInstanceId(instanceId))); } _listener.DeviceArrived += ListenerOnDeviceArrived; _listener.DeviceRemoved += ListenerOnDeviceRemoved; _listener.StartListen(this); }