Example #1
0
        /// <summary>
        /// Injects a mouse click in the bot window.
        /// </summary>
        /// <param name="button">The button type.</param>
        /// <param name="evt">The key event.</param>
        public void Click(Keys.Button button, Keys.Event evt)
        {
            Bot.ExeThreadSafe(delegate
            {
                if (_browser.GetMainFrame().IsMain)
                {
                    MouseButtonType mouseButtonType = 0;
                    bool up   = false;
                    bool down = false;

                    // get button type
                    switch (button)
                    {
                    case Keys.Button.LEFT:
                        mouseButtonType = MouseButtonType.Left;
                        break;

                    case Keys.Button.MIDDLE:
                        mouseButtonType = MouseButtonType.Middle;
                        break;

                    case Keys.Button.RIGHT:
                        mouseButtonType = MouseButtonType.Right;
                        break;
                    }

                    // get button event
                    switch (evt)
                    {
                    case Keys.Event.NULL:
                        break;

                    case Keys.Event.DOWN:
                        down = true;
                        break;

                    case Keys.Event.UP:
                        up = true;
                        break;

                    case Keys.Event.DOWNUP:
                        down = true;
                        up   = false;
                        break;

                    default:
                        break;
                    }

                    // Executes mouse click
                    _browser.GetBrowserHost().SendMouseClickEvent(_mouseEvent, mouseButtonType, up, 1);
                    Thread.Sleep(100);
                    _browser.GetBrowserHost().SendMouseClickEvent(_mouseEvent, mouseButtonType, down, 1);
                }
            });
        }
Example #2
0
 /// <summary>
 /// Injects a mouse click in the bot window.
 /// </summary>
 /// <param name="button">The button type.</param>
 /// <param name="evt">The key event.</param>
 public static void Click(Keys.Button button, Keys.Event evt, int x = -1, int y = -1)
 {
     Move(x, y);
     _mouse.Click(button, evt);
 }
Example #3
0
 /// <summary>
 /// Injects a left mouse click in the bot window.
 /// </summary>
 public static void Click(Keys.Button button = Keys.Button.LEFT, int x = -1, int y = -1)
 {
     Click(button, Keys.Event.DOWNUP, x, y);
 }