public void Stop() { try { WindowState = FormWindowState.Normal; Thread[] threads = { _leftClickThread, _rightClickThread, _customClickThread, _multipleListsThread }; foreach (Thread thread in threads) { ShutdownThread(thread); } if (_holdLeftMouseButton || _holdRightMouseButton) { if (_holdLeftMouseButton) { _mouseEventData.ReleaseMouse("left"); } else { _mouseEventData.ReleaseMouse("right"); } } _isRunning = false; _activeKey = Keys.None; if (_holdCTRL) { MouseEventData.keybd_event(MouseEventData.VK_CONTROL, 0, MouseEventData.KEYEVENTF_KEYUP, 0); } } catch (ThreadAbortException ex) { Console.WriteLine("Error terminating threads: " + ex); } }
public void Run() { if (_holdMouse) { _mouseEvents.HoldDownMouse("left"); return; } try { while (true) { if (_holdCTRL) { MouseEventData.keybd_event(MouseEventData.VK_CONTROL, 0, 0, 0); // HOLD DOWN CONTROL } _mouseEvents.ClickLeftMouseButtonEvent(); Thread.Sleep((int)(_mouseEvents.GetRandomizedClickSpeed(_randomize, _leftClickSpeed, _randomizationAmount) * 1000)); } } catch (Exception exc) { //MessageBox.Show(exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }