public void ProcessKeyInput(RawInputEventArg e) { //e.KeyPressEvent.DeviceHandle; //e.KeyPressEvent.DeviceType; //e.KeyPressEvent.DeviceName; //e.KeyPressEvent.Name; //e.KeyPressEvent.VKey.ToString(CultureInfo.InvariantCulture); //_rawinput.NumberOfKeyboards.ToString(CultureInfo.InvariantCulture); //e.KeyPressEvent.VKeyName; //e.KeyPressEvent.Source; //e.KeyPressEvent.KeyPressState; //string.Format("0x{0:X4} ({0})", e.KeyPressEvent.Message); lastKeyPressLabel.Text = e.KeyPressEvent.Source; if(!comboBox1.Items.Contains(e.KeyPressEvent.Source)) { comboBox1.Items.Add(e.KeyPressEvent.Source); } if (e.KeyPressEvent.Source == (string)comboBox1.SelectedItem) { switch (e.KeyPressEvent.VKeyName) { case "UP": case "X": forwards = e.KeyPressEvent.KeyPressState == "MAKE"; break; case "DOWN": case "Z": backwards = e.KeyPressEvent.KeyPressState == "MAKE"; break; case "Y": nextStation = e.KeyPressEvent.KeyPressState == "MAKE"; break; case "LEFT": left = e.KeyPressEvent.KeyPressState == "MAKE"; break; case "RIGHT": right = e.KeyPressEvent.KeyPressState == "MAKE"; break; } } }
private void OnKeyPressed(object sender, RawInputEventArg e) { lbHandle.Text = e.KeyPressEvent.DeviceHandle.ToString(); lbType.Text = e.KeyPressEvent.DeviceType; lbName.Text = e.KeyPressEvent.DeviceName; lbDescription.Text = e.KeyPressEvent.Name; lbKey.Text = e.KeyPressEvent.VKey.ToString(CultureInfo.InvariantCulture); lbNumKeyboards.Text = _rawinput.NumberOfKeyboards.ToString(CultureInfo.InvariantCulture); lbVKey.Text = e.KeyPressEvent.VKeyName; lbSource.Text = e.KeyPressEvent.Source; lbKeyPressState.Text = e.KeyPressEvent.KeyPressState; lbMessage.Text = string.Format("0x{0:X4} ({0})", e.KeyPressEvent.Message); //switch (e.KeyPressEvent.Message) //{ // case Win32.WM_KEYDOWN: // Debug.WriteLine(e.KeyPressEvent.KeyPressState); // break; // case Win32.WM_KEYUP: // Debug.WriteLine(e.KeyPressEvent.KeyPressState); // break; //} }
private static void OnKeyPressed(object sender, RawInputEventArg e) { _ITTF_SERVER_CONTROL_FORM.ProcessKeyInput(e); }