public override void Close()
 {
     base.Close();
     if (device != null)
     {
         device.FeedbackReceived -= DeviceFeedbackReceived;
         inputDevices.Remove(device);
     }
 }
Example #2
0
        public bool RemoveDevice(Device device)
        {
            var success = InputDevices.Remove(device) || OutputDevices.Remove(device);

            if (success)
            {
                OnPropertyChanged(nameof(InputDevices));
                OnPropertyChanged(nameof(OutputDevices));
                Context.ContextChanged();
            }

            return(success);
        }
Example #3
0
        public virtual bool Detect()
        {
            bool success = false;

            InputDevices.Clear();
            foreach (var config in _deviceConfigurationProvider.TabletConfigurations)
            {
                if (Match(config) is InputDeviceTree tree)
                {
                    success = true;
                    InputDevices.Add(tree);

                    tree.Disconnected += (sender, e) =>
                    {
                        InputDevices.Remove(tree);
                        TabletsChanged?.Invoke(this, Tablets);
                    };
                }
            }

            TabletsChanged?.Invoke(this, Tablets);

            return(success);
        }