Beispiel #1
0
        private void LeftButton(State state)
        {
            var isADown = state.Gamepad.Buttons.HasFlag(GamepadButtonFlags.A);

            if (isADown && !_wasADown)
            {
                _mouseSimulator.LeftButtonDown();
            }
            if (!isADown && _wasADown)
            {
                _mouseSimulator.LeftButtonUp();
            }
            _wasADown = isADown;
        }
        // Bumpers
        private void RightBumper_Button(State state)  // Right Mouse Click
        {
            var isRightBumperDown = state.Gamepad.Buttons.HasFlag(GamepadButtonFlags.RightShoulder);

            if (isRightBumperDown && !_wasRightBumperDown)
            {
                _mouseSimulator.LeftButtonDown();
            }
            if (!isRightBumperDown && _wasRightBumperDown)
            {
                _mouseSimulator.LeftButtonUp();
            }
            _wasRightBumperDown = isRightBumperDown;
        }
Beispiel #3
0
        public static void MouseButtonDown(this IMouseSimulator mouse, MouseButton button)
        {
            switch (button)
            {
            case MouseButton.LeftButton:
                mouse.LeftButtonDown();
                break;

            case MouseButton.RightButton:
                mouse.RightButtonDown();
                break;

            default:
                break;
            }
        }
Beispiel #4
0
        private void LeftBtn(State state)
        {
            var aDown = state.Gamepad.Buttons.HasFlag(GamepadButtonFlags.A);

            if (aDown && !aWasDown)
            {
                mouseSimulator.LeftButtonDown();
                CheckA.Dispatcher.Invoke(() => { CheckA.IsChecked = true; });
            }

            if (!aDown && aWasDown)
            {
                mouseSimulator.LeftButtonUp();
                CheckA.Dispatcher.Invoke(() => { CheckA.IsChecked = false; });
            }
            aWasDown = aDown;
        }
Beispiel #5
0
        public void Hold(string button)
        {
            int buttonNumber = ParseMouseButtonNumber(button);

            if (buttonNumber == 1)
            {
                _mouse.LeftButtonDown();
            }
            else if (buttonNumber == 2)
            {
                _mouse.RightButtonDown();
            }
            else if (buttonNumber == 3)
            {
                _mouse.MiddleButtonDown();
            }
            else if (buttonNumber > 3)
            {
                _mouse.XButtonDown(buttonNumber - 3);
            }
        }
Beispiel #6
0
        public void FireMouseEvent(IMouseSimulator a_ims, mousePacket a_mhs)
        {
            switch ((MouseEventFlag)a_mhs.flags)
            {
            case MouseEventFlag.MOUSEEVENTF_MOVE:
                a_ims.MoveMouseTo(a_mhs.x, a_mhs.y);
                break;

            case MouseEventFlag.MOUSEEVENTF_LEFTDOWN:
                a_ims.LeftButtonDown();
                break;

            case MouseEventFlag.MOUSEEVENTF_LEFTUP:
                a_ims.LeftButtonUp();
                break;

            case MouseEventFlag.MOUSEEVENTF_RIGHTDOWN:
                a_ims.RightButtonDown();
                break;

            case MouseEventFlag.MOUSEEVENTF_RIGHTUP:
                a_ims.RightButtonUp();
                break;

            case MouseEventFlag.MOUSEEVENTF_WHEEL:
                if (a_mhs.y > 0)
                {
                    a_ims.VerticalScroll(3);
                }
                else
                {
                    a_ims.VerticalScroll(-3);
                }
                break;
            }
        }
Beispiel #7
0
        protected void StartPressing(long ticks, VirtualKeyCode keyCode = VirtualKeyCode.SPACE)
        {
            Log.Debug($"Operation performed. IsKeyDown: {true}. Ticks: {ticks}.");
//            _keyboard.KeyDown(keyCode);
            _mouse.LeftButtonDown();
        }