/// <summary> /// Query DeviceInformation class for Midi Input devices /// </summary> private async Task EnumerateMidiInputDevices() { // Clear input devices InputDevices.Clear(); InputDeviceProperties.Clear(); inputDeviceProperties.IsEnabled = false; // Find all input MIDI devices string midiInputQueryString = MidiInPort.GetDeviceSelector(); DeviceInformationCollection midiInputDevices = await DeviceInformation.FindAllAsync(midiInputQueryString); // Return if no external devices are connected if (midiInputDevices.Count == 0) { InputDevices.Add("No MIDI input devices found!"); inputDevices.IsEnabled = false; NotifyUser("Please connect at least one external MIDI device for this demo to work correctly"); return; } // Else, add each connected input device to the list foreach (DeviceInformation deviceInfo in midiInputDevices) { InputDevices.Add(deviceInfo.Name); inputDevices.IsEnabled = true; } NotifyUser("MIDI Input devices found!"); }
public void UpdateDevices() { InputDevices.Clear(); OutputDevices.Clear(); VideoDevices.Clear(); for (int i = 0; i < WaveIn.DeviceCount; i++) { InputDevices.Add(new InputMenuData { Name = WaveIn.GetCapabilities(i).ProductName }); } for (int i = 0; i < WaveOut.DeviceCount; i++) { OutputDevices.Add(new OutputMenuData { Name = WaveOut.GetCapabilities(i).ProductName }); } var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); foreach (FilterInfo device in videoDevices) { VideoDevices.Add(new VideoMenuData { Name = device.Name }); } }
/// <summary> /// Clear all input and output MIDI device lists and properties /// </summary> private void ClearAllDeviceValues() { // Clear input devices InputDevices.Clear(); InputDevices.Add("Click button to list input MIDI devices"); inputDevices.IsEnabled = false; // Clear output devices OutputDevices.Clear(); OutputDevices.Add("Click button to list output MIDI devices"); outputDevices.IsEnabled = false; // Clear input device properties InputDeviceProperties.Clear(); InputDeviceProperties.Add("Select a MIDI input device to view its properties"); inputDeviceProperties.IsEnabled = false; // Clear output device properties OutputDeviceProperties.Clear(); OutputDeviceProperties.Add("Select a MIDI output device to view its properties"); outputDeviceProperties.IsEnabled = false; }
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); }