예제 #1
0
        private async Task ExecuteActions(List <ClickAction> actions)
        {
            int totalActions = actions.Count;

            for (int i = 0; i < totalActions; i++)
            {
                var action = actions[i];

                await Task.Delay(TimeSpan.FromMilliseconds(action.MilisecondsEllapsed));

                //skip the last action, where we press the stop button
                if (i == totalActions - 1)
                {
                    continue;
                }

                MouseUtils.MoveToScreenCoordinate(action.X, action.Y);

                if (action.ButtonClicked == MouseButtons.Left)
                {
                    MouseUtils.LeftClick();
                }
                else if (action.ButtonClicked == MouseButtons.Right)
                {
                    MouseUtils.RightClick();
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Renders an instruction onto the program grid. Assumes the grid is already scrolled to make the instruction
        /// location visible.
        /// </summary>
        public void Render(Vector2 position, Instruction instruction, int delay = 0)
        {
            if (instruction.IsRenderable())
            {
                var key          = m_instructionKeys[instruction];
                var gridLocation = m_grid.GetCellLocation(position);

                int keyTime   = delay;
                int clickTime = delay + 50;

                KeyDown(key);
                MouseUtils.SetCursorPosition(gridLocation);
                ThreadUtils.SleepOrAbort(keyTime);
                MouseUtils.LeftClick(clickTime);

                KeyUp(key);
                ThreadUtils.SleepOrAbort(keyTime);
            }
        }
예제 #3
0
        public async Task Start()
        {
            IsBusy = true;
            Clipboard.SetText(DumpertUrl);

            int count = 1;

            do
            {
                int totalActions = DumpertActions.Count;
                for (int i = 0; i < totalActions; i++)
                {
                    var action = DumpertActions[i];

                    await Task.Delay(TimeSpan.FromMilliseconds(action.MilisecondsEllapsed));

                    //skip the last action, where we press the stop button
                    if (i == totalActions - 1)
                    {
                        continue;
                    }

                    MouseUtils.MoveToScreenCoordinate(action.X, action.Y);

                    if (action.ButtonClicked == MouseButtons.Left)
                    {
                        MouseUtils.LeftClick();
                    }
                    else if (action.ButtonClicked == MouseButtons.Right)
                    {
                        MouseUtils.RightClick();
                    }
                }
                Form.SetStatus("Votes: " + count);
            } while (count++ < 5000 && IsBusy);
        }