Exemplo n.º 1
0
        private void DeviceRemoved(GazeDeviceWatcherPreview source,
                                   GazeDeviceWatcherRemovedPreviewEventArgs args)
        {
            // Decrement gaze device counter and remove event handlers
            if (IsSupportedDevice(args.Device))
            {
                _deviceCounter--;

                if (_deviceCounter == 0)
                {
                    _gazeInputSource.GazeEntered -= GazeEntered;
                    _gazeInputSource.GazeMoved   -= GazeTrackerMoved;
                    _gazeInputSource.GazeExited  -= GazeExited;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles disconnection of eye-tracking devices.
        /// </summary>
        /// <param name="sender">Source of the device removed event</param>
        /// <param name="e">Event args for the device removed event</param>
        private void DeviceRemoved(GazeDeviceWatcherPreview source,
                                   GazeDeviceWatcherRemovedPreviewEventArgs args)
        {
            // Decrement gaze device counter and remove event handlers.
            if (IsSupportedDevice(args.Device))
            {
                deviceCounter--;
                TrackerCounter.Text = deviceCounter.ToString();

                if (deviceCounter == 0)
                {
                    gazeInputSource.GazeEntered -= this.GazeEntered;
                    gazeInputSource.GazeMoved   -= this.GazeMoved;
                    gazeInputSource.GazeExited  -= this.GazeExited;
                }
            }
        }
        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);
            }
        }
Exemplo n.º 4
0
 private void OnDeviceRemoved(GazeDeviceWatcherPreview sender, GazeDeviceWatcherRemovedPreviewEventArgs args)
 {
     _deviceCount--;
     Log($"Device removed, count={_deviceCount}", args.Device);
 }