/// <summary> /// Start the IR Server plugin. /// </summary> /// <returns>true if successful, otherwise false.</returns> public override void Start() { LoadSettings(); InitDeviceList(); if (_deviceList.Count == 0) { throw new InvalidOperationException("No Direct Input devices connected"); } if (String.IsNullOrEmpty(_selectedDeviceGUID)) { #if TRACE Trace.WriteLine("No direct input device selected in plugin configuration, using first found"); #endif _deviceList.Reset(); // Move to the position before the first in the device list. _deviceList.MoveNext(); // Move to the first position in the device list. DeviceInstance di = (DeviceInstance)_deviceList.Current; // Retreive the first position in the device list. _selectedDeviceGUID = di.InstanceGuid.ToString(); } _diListener = new DirectInputListener(); _diListener.Delay = 150; _diListener.OnStateChange += diListener_OnStateChange; if (!AcquireDevice()) { throw new InvalidOperationException("Failed to acquire device"); } }
private void StartListener() { InitDeviceList(); if (_deviceList.Count == 0) { return; } IrssLog.Debug("DirectInput: Start listening..."); if (String.IsNullOrEmpty(_config.DeviceGUID)) { IrssLog.Info("No direct input device selected in plugin configuration, using first found"); // Retreive the first position in the device list. _config.DeviceGUID = _deviceList[0].InstanceGuid.ToString(); } _diListener = new DirectInputListener(); _diListener.Delay = 150; _diListener.OnStateChange += diListener_OnStateChange; if (!AcquireDevice()) { IrssLog.Warn("Failed to acquire device"); } }
/// <summary> /// Stop the IR Server plugin. /// </summary> public override void Stop() { if (_diListener != null) { _diListener.DeInitDevice(); _diListener.StopListener(); _diListener.OnStateChange -= diListener_OnStateChange; _diListener = null; } _deviceList = null; }
private void StopListener() { IrssLog.Debug("DirectInput: Stop listening..."); if (_diListener != null) { _diListener.DeInitDevice(); _diListener.StopListener(); _diListener.OnStateChange -= diListener_OnStateChange; _diListener = null; } _deviceList = null; }
public Configure(DeviceList deviceList) { InitializeComponent(); _diListener = new DirectInputListener(); _diListener.Delay = 150; foreach (DeviceInstance di in deviceList) { ListViewItem item = new ListViewItem( new string[] { di.InstanceName, di.ProductName } ); item.Tag = di.InstanceGuid.ToString(); listViewDevices.Items.Add(item); } }
public ConfigurationDialog(IEnumerable<DeviceInstance> deviceList) { InitializeComponent(); _diListener = new DirectInputListener(); _diListener.Delay = 150; foreach (DeviceInstance di in deviceList) { ListViewItem item = new ListViewItem( new string[] {di.InstanceName, di.ProductName} ); item.Tag = di.InstanceGuid.ToString(); listViewDevices.Items.Add(item); } }
private void StartListener() { InitDeviceList(); if (_deviceList.Count == 0) return; IrssLog.Debug("DirectInput: Start listening..."); if (String.IsNullOrEmpty(_config.DeviceGUID)) { IrssLog.Info("No direct input device selected in plugin configuration, using first found"); // Retreive the first position in the device list. _config.DeviceGUID = _deviceList[0].InstanceGuid.ToString(); } _diListener = new DirectInputListener(); _diListener.Delay = 150; _diListener.OnStateChange += diListener_OnStateChange; if (!AcquireDevice()) IrssLog.Warn("Failed to acquire device"); }
private void Configure_FormClosed(object sender, FormClosedEventArgs e) { _diListener.DeInitDevice(); _diListener = null; }
/// <summary> /// Start the IR Server plugin. /// </summary> /// <returns>true if successful, otherwise false.</returns> public override void Start() { LoadSettings(); InitDeviceList(); if (_deviceList.Count == 0) throw new InvalidOperationException("No Direct Input devices connected"); if (String.IsNullOrEmpty(_selectedDeviceGUID)) { #if TRACE Trace.WriteLine("No direct input device selected in plugin configuration, using first found"); #endif _deviceList.Reset(); // Move to the position before the first in the device list. _deviceList.MoveNext(); // Move to the first position in the device list. DeviceInstance di = (DeviceInstance)_deviceList.Current; // Retreive the first position in the device list. _selectedDeviceGUID = di.InstanceGuid.ToString(); } _diListener = new DirectInputListener(); _diListener.Delay = 150; _diListener.OnStateChange += diListener_OnStateChange; if (!AcquireDevice()) throw new InvalidOperationException("Failed to acquire device"); }