コード例 #1
0
        /// <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");
            }
        }
コード例 #2
0
        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");
            }
        }
コード例 #3
0
        /// <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;
        }
コード例 #4
0
        private void StopListener()
        {
            IrssLog.Debug("DirectInput: Stop listening...");

            if (_diListener != null)
            {
                _diListener.DeInitDevice();
                _diListener.StopListener();

                _diListener.OnStateChange -= diListener_OnStateChange;
                _diListener = null;
            }

            _deviceList = null;
        }
コード例 #5
0
ファイル: Configure.cs プロジェクト: nagyist/IR-Server-Suite
        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);
            }
        }
コード例 #6
0
    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);
      }
    }
コード例 #7
0
    private void StopListener()
    {
      IrssLog.Debug("DirectInput: Stop listening...");

      if (_diListener != null)
      {
        _diListener.DeInitDevice();
        _diListener.StopListener();

        _diListener.OnStateChange -= diListener_OnStateChange;
        _diListener = null;
      }

      _deviceList = null;
    }
コード例 #8
0
    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");
    }
コード例 #9
0
ファイル: Configure.cs プロジェクト: nagyist/IR-Server-Suite
 private void Configure_FormClosed(object sender, FormClosedEventArgs e)
 {
     _diListener.DeInitDevice();
     _diListener = null;
 }
コード例 #10
0
 private void Configure_FormClosed(object sender, FormClosedEventArgs e)
 {
   _diListener.DeInitDevice();
   _diListener = null;
 }
コード例 #11
0
    /// <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;
    }
コード例 #12
0
    /// <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");
    }