/// <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); } }); }
/// <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); }