public override void Close() { base.Close(); if (device != null) { device.FeedbackReceived -= DeviceFeedbackReceived; inputDevices.Remove(device); } }
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); }
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); }