예제 #1
0
        private void RightButton(State state)
        {
            var isBDown = state.Gamepad.Buttons.HasFlag(GamepadButtonFlags.B);

            if (isBDown && !_wasBDown)
            {
                _mouseSimulator.RightButtonDown();
            }
            if (!isBDown && _wasBDown)
            {
                _mouseSimulator.RightButtonUp();
            }
            _wasBDown = isBDown;
        }
예제 #2
0
        private void LeftBumper_Button(State state) // Left Mouse Click
        {
            var isLeftBumperDown = state.Gamepad.Buttons.HasFlag(GamepadButtonFlags.LeftShoulder);

            if (isLeftBumperDown && !_wasLeftBumperDown)
            {
                _mouseSimulator.RightButtonDown();
            }
            if (!isLeftBumperDown && _wasLeftBumperDown)
            {
                _mouseSimulator.RightButtonUp();
            }
            _wasLeftBumperDown = isLeftBumperDown;
        }
예제 #3
0
        private void RightBtn(State state)
        {
            var bDown = state.Gamepad.Buttons.HasFlag(GamepadButtonFlags.B);

            if (bDown && !bWasDown)
            {
                mouseSimulator.RightButtonDown();
                CheckB.Dispatcher.Invoke(() => { CheckB.IsChecked = true; });
            }
            if (!bDown && bWasDown)
            {
                mouseSimulator.RightButtonUp();
                CheckB.Dispatcher.Invoke(() => { CheckB.IsChecked = false; });
            }
            bWasDown = bDown;
        }
예제 #4
0
        public static void MouseButtonUp(this IMouseSimulator mouse, MouseButton button)
        {
            switch (button)
            {
            case MouseButton.LeftButton:
                mouse.LeftButtonUp();
                break;

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

            default:
                break;
            }
        }
예제 #5
0
        public void Release(string button)
        {
            int buttonNumber = ParseMouseButtonNumber(button);

            if (buttonNumber == 1)
            {
                _mouse.LeftButtonUp();
            }
            else if (buttonNumber == 2)
            {
                _mouse.RightButtonUp();
            }
            else if (buttonNumber == 3)
            {
                _mouse.MiddleButtonUp();
            }
            else if (buttonNumber > 3)
            {
                _mouse.XButtonUp(buttonNumber - 3);
            }
        }
예제 #6
0
        public async Task RightClickMiddle(double radians)
        {
            _wowWindow.SetForeground();
            var pixel = radians / 0.03927 * 10;

            var p = _wowWindow.ClientRectangle.Middle();

            await SetCursorPos(p);

            _wowWindow.SetForeground();
            await Sleep(100);

            _mouseSimulator.RightButtonDown();
            await Sleep(100);

            _mouseSimulator.MoveMouseBy((int)pixel, 0);
            await Sleep(100);

            _mouseSimulator.RightButtonUp();
            await Sleep(3000);
        }
예제 #7
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;
            }
        }