private void OnKeyboardKeyUp(KeyboardHookEventArgs e)
 {
     if (KeyBoardKeyUp != null)
         KeyBoardKeyUp(this, e);
     OnKeyboardKeyEvent(e);
 }
        /// <summary>
        ///     This is the call-back method that is called whenever a keyboard event is triggered.
        ///     We use it to call our individual custom events.
        /// </summary>
        private IntPtr KeyboardHookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (!Enabled) return Win32.CallNextHookEx(hookId, nCode, wParam, lParam);

            if (nCode >= 0)
            {
                var lParamStruct = (KeyboardHookStruct) Marshal.PtrToStructure(lParam, typeof (KeyboardHookStruct));
                var e = new KeyboardHookEventArgs(lParamStruct);
                switch ((KeyboardMessages) wParam)
                {
                    case KeyboardMessages.WmSyskeydown:
                    case KeyboardMessages.WmKeydown:
                        e.KeyboardEventName = KeyboardEventNames.KeyDown;
                        OnKeyboardKeyDown(e);
                        break;

                    case KeyboardMessages.WmSyskeyup:
                    case KeyboardMessages.WmKeyup:
                        e.KeyboardEventName = KeyboardEventNames.KeyUp;
                        OnKeyboardKeyUp(e);
                        break;
                }

                if (e.Handled)
                {
                    return (IntPtr) (-1);
                }
            }
            return Win32.CallNextHookEx(hookId, nCode, wParam, lParam);
        }