public static async Task DoMouseActionAsync(
            double x, double y, MouseActionTypes action, int doubleClickIntervalMillisec
            )
        {
            if (action == MouseActionTypes.None)
            {
                return;
            }

            System.Windows.Forms.Cursor.Position = new System.Drawing.Point((int)x, (int)y);

            //specify flags
            uint flag = GetMouseEventFlag(action);

            if (flag == 0)
            {
                return;
            }

            var input = new MouseInput()
            {
                TypeTag = InputStructConsts.INPUT_MOUSE,
                //Dx = (int)x,
                //Dy = (int)y,
                Dx        = 0,
                Dy        = 0,
                MouseData = 0,
                Flags     = flag,
                Time      = 0,
                ExtraInfo = 0
            };

            //処理に入るのが確定した時点で遅延させる。理由は視点アイコンが消えてマウスと干渉しなくなるまで最低1フレーム欲しいから。
            await Task.Delay(16);

            SendInputOneTime(input);

            //ダブルクリックの場合だけ続けて2クリック目飛ばす
            switch (action)
            {
            case MouseActionTypes.LeftDoubleClick:
            case MouseActionTypes.RightDoubleClick:
                await Task.Delay(doubleClickIntervalMillisec);

                SendInputOneTime(input);
                break;

            default:
                break;
            }
        }
        private static uint GetMouseEventFlag(MouseActionTypes action)
        {
            switch (action)
            {
            case MouseActionTypes.LeftSingleClick:
            case MouseActionTypes.LeftDoubleClick:
                return(MouseEventFlags.MOUSEEVENTF_LEFTDOWN | MouseEventFlags.MOUSEEVENTF_LEFTUP);

            case MouseActionTypes.RightSingleClick:
            case MouseActionTypes.RightDoubleClick:
                return(MouseEventFlags.MOUSEEVENTF_RIGHTDOWN | MouseEventFlags.MOUSEEVENTF_RIGHTUP);

            case MouseActionTypes.CenterClick:
                return(MouseEventFlags.MOUSEEVENTF_MIDDLEDOWN | MouseEventFlags.MOUSEEVENTF_MIDDLEUP);

            default:
                return(0);
            }
        }
        private async void OnBlinkAction(object sender, BlinkActionEventArgs e)
        {
            MouseActionTypes mouseAction = GetMouseActionTypeFrom(
                e.ActionType,
                _volatileSetting.ActionType,
                _setting.Setting
                );

            int interval = (int)_setting.Setting.MouseDoubleClickIntervalMillisec;

            //処理の前に撃つ: タスク開始時点で実行するという事自体は確定するので。
            if (mouseAction != MouseActionTypes.None)
            {
                MouseActionStart?.Invoke(this, new MouseActionEventArgs(e.X, e.Y, mouseAction));
            }

            await ClickCommandExecutor.DoMouseActionAsync(
                e.X, e.Y, mouseAction, interval
                );
        }
 public MouseActionEventArgs(double x, double y, MouseActionTypes actionType)
 {
     X          = x;
     Y          = y;
     ActionType = actionType;
 }