public ActionResult <IEnumerable <InputDeviceInfo> > ListInputDevices() { var inputDevices = inputDeviceManager.GetInputDevices(); return(inputDevices.Select(d => new InputDeviceInfo { Id = d.UniqueId, Name = d.DisplayName, ActiveFeatures = d.GetActiveFeatures(), }).ToList()); }
public ActionResult <IEnumerable <InputDeviceInfo> > ListInputDevices() { var inputDevices = inputDeviceManager.GetInputDevices(); return(inputDevices.Select(d => new InputDeviceInfo { Id = d.UniqueId, Name = d.DisplayName, Axes = d.Sources.Where(s => s.IsAxis).Count(), DPads = d.Sources.Where(s => s.IsDPad).Count() / 4, Buttons = d.Sources.Where(s => s.IsButton).Count(), Sliders = d.Sources.Where(s => s.IsSlider).Count(), }).ToList()); }
public MainWindowViewModel(MainWindowModel model, InputDeviceManager inputDeviceManager) : base(model) { this.inputDeviceManager = inputDeviceManager; foreach (var inputDeviceHolder in inputDeviceManager.GetInputDevices()) { foreach (var inputDevice in inputDeviceHolder.GetInputDevices().Where(d => d.InputMethod == InputDeviceMethod.DirectInput).OfType <DirectInputDevice>()) { Model.DirectInputs.Add(inputDevice); } foreach (var inputDevice in inputDeviceHolder.GetInputDevices().Where(d => d.InputMethod == InputDeviceMethod.RawInput).OfType <RawInputDevice>()) { Model.RawInputs.Add(inputDevice); } } }