Inheritance: System.Windows.Forms.NativeWindow
示例#1
0
 public static void Initialize(IntPtr windowHandle)
 {
     // Initialize device event dispatcher.
     Guid hidClassGuid;
     Hid.HidD_GetHidGuid(out hidClassGuid);
     deviceEventNotifier = new DeviceEventNotifier(windowHandle, hidClassGuid);
     // Register for device removal/arrival events so we can keep
     // track of the currently attached devices of interest.
     deviceEventNotifier.DeviceArrival += DeviceAdded;
     deviceEventNotifier.DeviceRemoval += DeviceRemoved;
     // Open all devices we can find for now.
     devices = new Dictionary<string, HidDevice>();
     var devs = HidDevice.Open(vendorId, productIds);
     foreach (var dev in devs) {
         devices.Add(dev.DevicePath.ToUpper(), dev);
     }
 }
示例#2
0
        public static void Initialize(IntPtr windowHandle)
        {
            // Initialize device event dispatcher.
            Guid hidClassGuid;

            Hid.HidD_GetHidGuid(out hidClassGuid);
            deviceEventNotifier = new DeviceEventNotifier(windowHandle, hidClassGuid);
            // Register for device removal/arrival events so we can keep
            // track of the currently attached devices of interest.
            deviceEventNotifier.DeviceArrival += DeviceAdded;
            deviceEventNotifier.DeviceRemoval += DeviceRemoved;
            // Open all devices we can find for now.
            devices = new Dictionary <string, HidDevice>();
            var devs = HidDevice.GetDevices(vendorId, productIds);

            foreach (var dev in devs)
            {
                devices.Add(dev.DevicePath.ToUpper(), dev);
            }
        }
        public static void Init(IntPtr windowHandle, params LogitechKeyboardType[] keyboardsToListenFor)
        {
            KeyboardsToListenFor = keyboardsToListenFor;

            // Initialize device event dispatcher.
            Guid hidClassGuid;
            Hid.HidD_GetHidGuid(out hidClassGuid);
            deviceEventNotifier = new DeviceEventNotifier(windowHandle, hidClassGuid);
            // Register for device removal/arrival events so we can keep
            // track of the currently attached devices of interest.
            deviceEventNotifier.DeviceArrival += DeviceAdded;
            deviceEventNotifier.DeviceRemoval += DeviceRemoved;

            devices = new List<LogitechKeyboard>();

            // Open all devices we can find for now.
            var devs = HidDevice.Open(VENDOR_ID, keyboardsToListenFor.Select(d => d.ProductID));

            foreach (var dev in devs) {
                devices.Add(new LogitechKeyboard(dev, keyboardsToListenFor.Where(k => k.ProductID == dev.ProductId).First()));
            }
        }
示例#4
0
        public static void Init(IntPtr windowHandle, params LogitechKeyboardType[] keyboardsToListenFor)
        {
            KeyboardsToListenFor = keyboardsToListenFor;

            // Initialize device event dispatcher.
            Guid hidClassGuid;

            Hid.HidD_GetHidGuid(out hidClassGuid);
            deviceEventNotifier = new DeviceEventNotifier(windowHandle, hidClassGuid);
            // Register for device removal/arrival events so we can keep
            // track of the currently attached devices of interest.
            deviceEventNotifier.DeviceArrival += DeviceAdded;
            deviceEventNotifier.DeviceRemoval += DeviceRemoved;

            devices = new List <LogitechKeyboard>();

            // Open all devices we can find for now.
            var devs = HidDevice.Open(VENDOR_ID, keyboardsToListenFor.Select(d => d.ProductID));

            foreach (var dev in devs)
            {
                devices.Add(new LogitechKeyboard(dev, keyboardsToListenFor.Where(k => k.ProductID == dev.ProductId).First()));
            }
        }