示例#1
0
    private void Init()
    {
      _deviceClass = new Guid(0x7951772d, 0xcd50, 0x49b7, 0xb1, 0x03, 0x2b, 0xaa, 0xc4, 0x94, 0xfc, 0x57);
      _deviceBuffer = new byte[4096];

      _notifyWindow = new NotifyWindow();
      _notifyWindow.Create();
      _notifyWindow.Class = _deviceClass;
      _notifyWindow.DeviceArrival += OnDeviceArrival;
      _notifyWindow.DeviceRemoval += OnDeviceRemoval;
      _notifyWindow.RegisterDeviceArrival();

      // we need somewhere to store the smaller packets as they arrive
      _packetArray = new ArrayList();

      Open();
    }
示例#2
0
    private void Init()
    {
      try
      {
        // ask the OS for the class (GUID) that represents human input devices
        HidD_GetHidGuid(ref _deviceClass);

        _doubleClickTime = GetDoubleClickTime();
        _deviceBuffer = new byte[256];
        _notifyWindow = new NotifyWindow();
        _notifyWindow.Create();
        _notifyWindow.Class = _deviceClass;
        _notifyWindow.DeviceArrival += OnDeviceArrival;
        _notifyWindow.DeviceRemoval += OnDeviceRemoval;
        _notifyWindow.SettingsChanged += OnSettingsChanged;
        _notifyWindow.RegisterDeviceArrival();

        Open();
      }
      catch (Exception e)
      {
        Log.Write("Remote.Init: {0}", e.Message);
      }
    }