private void OnDeviceAdded(GazeDeviceWatcherPreview sender, GazeDeviceWatcherAddedPreviewEventArgs args) { _devices.Add(args.Device); if (_devices.Count == 1) { IsDeviceAvailableChanged?.Invoke(null, null); InitializeGazeInputSource(); } }
private void OnDeviceRemoved(GazeDeviceWatcherPreview sender, GazeDeviceWatcherRemovedPreviewEventArgs args) { var index = 0; while (index < _devices.Count && _devices.ElementAt(index).Id != args.Device.Id) { index++; } if (index < _devices.Count) { _devices.RemoveAt(index); } else { _devices.RemoveAt(0); } if (_devices.Count == 0) { IsDeviceAvailableChanged?.Invoke(null, null); } }