Esempio n. 1
0
        internal static ResponseStatus SendMouseDoubleClick()
        {
            using (InputController.Activate(inputType: PointerInputType.Mouse)) {
                PointerInput.Click(button: PointerButtons.Primary, count: 2);
            }

            return(ResponseStatus.Success);
        }
Esempio n. 2
0
        internal static ResponseStatus SendMouseAction(
            string actionType,
            int buttonNumber)
        {
            var            responseStatus = ResponseStatus.UnknownError;
            PointerButtons button;

            switch (buttonNumber)
            {
            case 0:
                button = PointerButtons.Primary;
                break;

            case 1:
                button = PointerButtons.Middle;
                break;

            case 2:
                button = PointerButtons.Secondary;
                break;

            default:
                throw new ArgumentException(message: string.Format(format: "Bad mouse button value: {0}. Valid values are LEFT = 0, MIDDLE = 1, RIGHT = 2", arg0: buttonNumber));
            }

            if (!(actionType == "buttondown"))
            {
                if (!(actionType == "buttonup"))
                {
                    if (actionType == "click")
                    {
                        using (InputController.Activate(inputType: PointerInputType.Mouse)) {
                            PointerInput.Click(button: button, count: 1);
                        }

                        responseStatus = ResponseStatus.Success;
                    }
                }
                else
                {
                    using (InputController.Activate(inputType: PointerInputType.Mouse)) {
                        PointerInput.Release(button: button);
                    }

                    responseStatus = ResponseStatus.Success;
                }
            }
            else
            {
                using (InputController.Activate(inputType: PointerInputType.Mouse)) {
                    PointerInput.Press(button: button);
                }

                responseStatus = ResponseStatus.Success;
            }

            return(responseStatus);
        }