private void runningstate() { progressLBL.Invoke((MethodInvoker)(() => progressLBL.Visible = true)); ScanButton.Invoke((MethodInvoker)(() => ScanButton.Enabled = false)); ScanButton.Invoke((MethodInvoker)(() => ScanButton.Visible = true)); StopButton.Invoke((MethodInvoker)(() => StopButton.Enabled = true)); StopButton.Invoke((MethodInvoker)(() => StopButton.Visible = true)); }
/// <summary> /// Function called when firing clicker hotkey. /// </summary> public void StartPauseEvent(object sender, KeyPressedEventArgs e) { if (IsClickerStarted) { StopButton.Invoke(new Action(() => StopButton_Click(null, null))); } else { StartButton.Invoke(new Action(() => StartButton_Click(null, null))); } }
private void defaultstate(bool state) { exportButton.Invoke((MethodInvoker)(() => exportButton.Visible = true)); exportButton.Invoke((MethodInvoker)(() => exportButton.Enabled = true)); progressLBL.Invoke((MethodInvoker)(() => progressLBL.Visible = false)); progressLBL.Invoke((MethodInvoker)(() => progressLBL.Text = "")); progressLBL.Invoke((MethodInvoker)(() => progressLBL.Visible = state)); ScanButton.Invoke((MethodInvoker)(() => ScanButton.Enabled = true)); ScanButton.Invoke((MethodInvoker)(() => ScanButton.Visible = true)); StopButton.Invoke((MethodInvoker)(() => StopButton.Enabled = false)); StopButton.Invoke((MethodInvoker)(() => StopButton.Visible = false)); }
/// <summary> /// Autoclicking task. /// </summary> public void ClickerTask() { if (IsClickerStarted) { return; } IsClickerStarted = true; ClickTask = new Thread(() => { // Get Interval int intervalms = 5; try { intervalms = (string.IsNullOrEmpty(HourBox.Text) ? 0 : int.Parse(HourBox.Text) * 3600000) + (string.IsNullOrEmpty(MinBox.Text) ? 0 : int.Parse(MinBox.Text) * 60000) + (string.IsNullOrEmpty(SecBox.Text) ? 0 : int.Parse(SecBox.Text) * 1000) + (string.IsNullOrEmpty(MSBox.Text) ? 0 : int.Parse(MSBox.Text)); } catch { } // Get Amount int index = 0; int maxIndex = 1; try { maxIndex = int.Parse(RepeatBox.Text); } catch { } while (RepeatAmountButton.Checked ? index < maxIndex : true) { index++; bool isDoubleClick = (bool)ClickCombo.Invoke( new Func <bool>(() => ClickCombo.SelectedIndex == 1)); if (LeftTick.Checked) { for (int i = 0; i < (isDoubleClick ? 2 : 1); i++) { mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0); } } if (RightTick.Checked) { for (int i = 0; i < (isDoubleClick ? 2 : 1); i++) { mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0); } } if (MiddleTick.Checked) { for (int i = 0; i < (isDoubleClick ? 2 : 1); i++) { mouse_event(MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0); mouse_event(MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0); } } Thread.Sleep(intervalms); } StopButton.Invoke(new Action(() => StopButton_Click(null, null))); }); ClickTask.IsBackground = true; ClickTask.Start(); }