public InputEventKeyboard(KeyboardEvent eventType, InputEventKeyboard parent) : base(parent) { _eventType = eventType; _keyCode = parent._keyCode; _keyDataExtra = parent._keyDataExtra; }
/// <summary> /// Raises the OnChar event. Override this method to add code to handle when a WM_CHAR message is received /// </summary> /// <param name="e">InputEventCKB for the OnChar event</param> private void invokeChar(InputEventKeyboard e) { if (KeyChar != null) { KeyChar(e); } }
/// <summary> /// Raises the KeyUp event. Override this method to add code to handle when a key is released /// </summary> /// <param name="e">KeyboardPressEventArgs for the KeyUp event</param> private void invokeKeyUp(InputEventKeyboard e) { if (KeyUp != null) { KeyUp(e); } }
/// <summary> /// Raises the KeyDown event. Override this method to add code to handle when a key is pressed /// </summary> /// <param name="e">InputEventCKB for the KeyDown event</param> private void invokeKeyDown(InputEventKeyboard e) { if (KeyDown != null) { KeyDown(e); } }
/// <summary> /// Reads the supplied message and executes any Keyboard events required. /// </summary> /// <param name="message">The Message to parse</param> /// <returns>A Boolean value indicating wether the Key events were handled or not</returns> private void WmKeyEvent(ref Message message) { // HandleKeyBindings(); // KeyPressEventArgs keyPressEventArgs = null; InputEventKeyboard InputEventCKB = null; if ((message.Id == NativeConstants.WM_CHAR) || (message.Id == NativeConstants.WM_SYSCHAR)) { // Is this extra information necessary? // wm_(sys)char: http://msdn.microsoft.com/en-us/library/ms646276(VS.85).aspx InputEventCKB = new InputEventKeyboard(KeyboardEvent.Press, (WinKeys)(int)(long)message.WParam, (int)(long)message.LParam, ModifierKeys ); IntPtr zero = (IntPtr)0;// (char)((ushort)((long)message.WParam)); invokeChar(InputEventCKB); } else { // wm_(sys)keydown: http://msdn.microsoft.com/en-us/library/ms912654.aspx // wm_(sys)keyup: http://msdn.microsoft.com/en-us/library/ms646281(VS.85).aspx InputEventCKB = new InputEventKeyboard(KeyboardEvent.Up, (WinKeys)(int)(long)message.WParam, (int)(long)message.LParam, ModifierKeys ); if ((message.Id == NativeConstants.WM_KEYDOWN) || (message.Id == NativeConstants.WM_SYSKEYDOWN)) { invokeKeyDown(InputEventCKB); } else if ((message.Id == NativeConstants.WM_KEYUP) || (message.Id == NativeConstants.WM_SYSKEYUP)) { invokeKeyUp(InputEventCKB); } } }