コード例 #1
0
ファイル: PastingHandler.cs プロジェクト: defrii/Wiseboard
        private bool HandleEarlyPastedKeyPressed(Key key, int typeOfPress)
        {
            if (key == Key.V && TypeOfPressChecker.IsKeyDownPressed(typeOfPress) && !IsPastingStarted())
            {
                PasteStart();
            }
            else if (_hookedKeys.Contains(key) && TypeOfPressChecker.IsKeyUpPressed(typeOfPress) &&
                     IsPastingStarted() && !_clipboardEventsHandler.IsItemSelectingFromClipboard())
            {
                PasteStop();
            }
            else if (key == Key.V && TypeOfPressChecker.IsKeyDownPressed(typeOfPress) &&
                     _clipboardEventsHandler.IsItemSelectingFromClipboard() &&
                     !_clipboardEventsHandler.CanChangePositionOfSelectedItem())
            {
                SetNextElement();
                _clipboardEventsHandler.SetChangePositionOfSelectedItem(true);
            }
            else if (key == Key.V && TypeOfPressChecker.IsKeyUpPressed(typeOfPress))
            {
                _clipboardEventsHandler.SetChangePositionOfSelectedItem(false);
            }
            if (key == Key.V)
            {
                return(true);
            }

            return(false);
        }
コード例 #2
0
ファイル: PastingHandler.cs プロジェクト: defrii/Wiseboard
        public int CaptureKeySinglePress(int code, int wParam, ref KeyboardHookStruct lParam)
        {
            if (code >= 0)
            {
                Key key = KeyInterop.KeyFromVirtualKey(lParam.VkCode);

                if (_clipboardEventsHandler.IsPastedBeforeDisplayClipboard())
                {
                    if (HandleEarlyPastedKeyPressed(key, wParam))
                    {
                        return(1);
                    }
                }
                if (TypeOfPressChecker.IsKeyDownPressed(wParam))
                {
                    KeyDownKeyHandle(key);
                }
                else if (TypeOfPressChecker.IsKeyUpPressed(wParam))
                {
                    KeyUpKeyHandle(key);
                }
            }
            return(CallNextHookEx(_hHook, code, wParam, ref lParam));
        }