private async void btn_Start_Click(object sender, EventArgs e) { if (giveawayDetails.Count() == 0) { MessageBox.Show("No details are set!", "GTS Bot", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } btn_Stop.Enabled = true; btn_Start.Enabled = false; Program.gd.disableButtons(); botWorking = true; botStop = false; botNumber = 3; int tradeDirection = 0; if (rb_frontfpo.Checked) { tradeDirection = 1; } else if (rb_front.Checked) { tradeDirection = 2; } GTSBot7 = new GTSBot7(pid, combo_pkmnList.SelectedIndex + 1, combo_gender.SelectedIndex, combo_levelrange.SelectedIndex, cb_Blacklist.Checked, cb_Reddit.Checked, tradeDirection, tb_waittime.Text, tb_consoleName.Text, cb_UseLedySync.Checked, tb_LedySyncIP.Text, tb_LedySyncPort.Text, game, true, "127.0.0.1", "3001"); Task <int> Bot = GTSBot7.RunBot(); int result = await Bot; if (botStop) { result = 8; } switch (result) { case 1: MessageBox.Show("All Pokemon Traded.", "GTS Bot", MessageBoxButtons.OK, MessageBoxIcon.Information); break; case 8: MessageBox.Show("Bot stopped by user.", "GTS Bot", MessageBoxButtons.OK, MessageBoxIcon.Information); break; default: MessageBox.Show("An error has occurred.", "GTS Bot", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } Program.gd.enableButtons(); btn_Stop.Enabled = false; btn_Start.Enabled = true; botWorking = false; botNumber = -1; }
private async void btn_Start_Click(object sender, EventArgs e) { if (giveawayDetails.Count() == 0) { MessageBox.Show("No details are set!", "GTS Bot", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } btn_Stop.Enabled = true; btn_Start.Enabled = false; Program.gd.disableButtons(); botWorking = true; botStop = false; botNumber = 3; GTSBot7 = new GTSBot7(pid, tb_PokemonToFind.Text, cb_Blacklist.Checked, cb_Reddit.Checked); Task <int> Bot = GTSBot7.RunBot(); int result = await Bot; if (botStop) { result = 8; } switch (result) { case 1: MessageBox.Show("All Pokemon Traded.", "GTS Bot", MessageBoxButtons.OK, MessageBoxIcon.Information); break; case 8: MessageBox.Show("Bot stopped by user.", "GTS Bot", MessageBoxButtons.OK, MessageBoxIcon.Information); break; default: MessageBox.Show("An error has occurred.", "GTS Bot", MessageBoxButtons.OK, MessageBoxIcon.Error); break; } Program.gd.enableButtons(); btn_Stop.Enabled = false; btn_Start.Enabled = true; botWorking = false; botNumber = -1; }