public KeyboardListItem(LogitechKeyboard keyboard)
        {
            InitializeComponent();

            lblKeyboardName.Text = keyboard.Device.DevicePath;
            pictureBox1.BackColor = keyboard.BackLightColor;
            btnChangeColor.Text = HexConverter(keyboard.BackLightColor);

            this.keyboard = keyboard;
        }
Exemple #2
0
        private static void DeviceAdded(object sender, DeviceEventArgs args)
        {
            HidDevice hidDevice = HidDevice.Open(args.DevicePath);

            // We can be sure a hid device was be returned,
            // since we only registered device notifications
            // for hid devices.
            if (VENDOR_ID == hidDevice.VendorId && KeyboardsToListenFor.Any(d => d.ProductID == hidDevice.ProductId))
            {
                // The device added appears to be a backlight device.
                LogitechKeyboard keyboard = new LogitechKeyboard(hidDevice, KeyboardsToListenFor.Where(k => k.ProductID == hidDevice.ProductId).First());
                devices.Add(keyboard);
                if (KeyboardConnected != null)
                {
                    KeyboardConnected(null, new LogitechKeyboardEventArgs(keyboard));
                }
            }
            else
            {
                // Not a backlight device, dispose!
                hidDevice.Dispose();
            }
        }
Exemple #3
0
 public LogitechKeyboardEventArgs(LogitechKeyboard keyboard)
 {
     Keyboard = keyboard;
 }
 private static void DeviceAdded(object sender, DeviceEventArgs args)
 {
     HidDevice hidDevice = HidDevice.Open(args.DevicePath);
     // We can be sure a hid device was be returned,
     // since we only registered device notifications
     // for hid devices.
     if (VENDOR_ID == hidDevice.VendorId && KeyboardsToListenFor.Any(d => d.ProductID == hidDevice.ProductId)) {
         // The device added appears to be a backlight device.
         LogitechKeyboard keyboard = new LogitechKeyboard(hidDevice, KeyboardsToListenFor.Where(k => k.ProductID == hidDevice.ProductId).First());
         devices.Add(keyboard);
         if (KeyboardConnected != null)
             KeyboardConnected(null, new LogitechKeyboardEventArgs(keyboard));
     }
     else {
         // Not a backlight device, dispose!
         hidDevice.Dispose();
     }
 }
 public LogitechKeyboardEventArgs(LogitechKeyboard keyboard)
 {
     Keyboard = keyboard;
 }