// This event handler is where the time-consuming work is done. // ------ backgroundWorker1 - MouseSpam ----------- public static void bgw1DoWork(object sender, DoWorkEventArgs e) { //while(MainWindow.LeftMouseDown == true) { //mousestrave //int x = 100; //x-coordinate //int y = 500; int i = 0; while (1 < 2 && MainWindow.StopAutoPvP == false) { if (backgroundWorker1.CancellationPending == true) { e.Cancel = true; MouseActions.LeftMouseUp(); BgwCancelAsyn(backgroundWorker3); //cancels Mousemovement as well break; } else { // Perform a time consuming operation and report progress. //MouseActions.Click(); MouseActions.LeftMouseDown(); System.Threading.Thread.Sleep(2); //backgroundWorker1.ReportProgress(i * 10); } i++; } BgwCancelAsyn(backgroundWorker1); BgwCancelAsyn(backgroundWorker3); //cancels Mousemovement as well }
public static void ClickSpam(int AmountOfClicks, int PauseBetwClicksInMS) { for (int Clickcount = 0; Clickcount < AmountOfClicks; Clickcount++) { MouseActions.LeftMouseUp(); MouseActions.LeftMouseDown(); Stopwatch st = new Stopwatch(); st.Start(); while (st.Elapsed < TimeSpan.FromMilliseconds(PauseBetwClicksInMS)) { // } st.Stop(); //Requieres HelperClass KeyboardInput (Solution AutoSF) //if(Clickcount < 20) { // KeyboardInput.Send(KeyboardInput.ScanCodeShort.KEY_F); //} } }