private void button2_Click(object sender, EventArgs e) { if (BotList.Count == 0) { MessageBox.Show("No Bots Added!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (IsStarted) { MessageBox.Show("Already Started!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Program.botRunning = true; Invoke(new Action(() => { int Amount = BotList.Count; foreach (Thread Bot in BotList) { Bot.Start(); } PreventSleepMode.ToggleSleepMode(true); MessageBox.Show($"{Amount} Bots have been started!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); IsStarted = true; })); }
private void button4_Click(object sender, EventArgs e) { if (BotList.Count == 0) { MessageBox.Show("No Bots Added!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!IsStarted) { MessageBox.Show("Bots aren't started yet!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } int Amount = BotList.Count; foreach (Thread Bot in BotList) { Bot.Abort(1); } Program.botRunning = false; BotList.Clear(); WindowList.Clear(); listView1.Items.Clear(); IsStarted = false; PreventSleepMode.ToggleSleepMode(false); MessageBox.Show($"{Amount} Bots have been Stopped and removed from List!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); }