private void Keyboards_DevicesChanged(object s, DevicesChangedEventArgs e) { listBox1.Items.Add("Devices Changed"); if (e.OldDevices != null) { foreach (var keyboard in e.OldDevices) { keyboard.KeyDown -= keyboard_KeyDown; keyboard.KeyUp -= keyboard_KeyUp; } } if (e.NewDevices != null) { foreach (var keyboard in e.NewDevices) { keyboard.KeyDown += keyboard_KeyDown; keyboard.KeyUp += keyboard_KeyUp; } } }
void Keyboard_DevicesChanged(IRawKeyboard s, DevicesChangedEventArgs e) { rfidReader.Keyboard = e.NewDevices[3]; }