private void moveToOnlineButton_Click(object sender, EventArgs e) { if (BotRunnerOptions.GetValueBool("AutoBotRemoveEnabled")) { MessageBox.Show(this, "This option is disabled while auto-removing bots is enabled.", "Can't do that.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } object selectedObj = reservedList.SelectedItem; if (selectedObj == null) { moveToOnlineButton.Enabled = false; return; } string botUsername = (string)selectedObj; try { botManager.MoveBotFromReserve(botUsername); InsertTextIntoConsole(String.Format("Bot {0} re-added.", botUsername)); } catch (Exception) { MessageBox.Show(this, String.Format("Cannot connect with the bot {0}!", botUsername), "Cannot connect.", MessageBoxButtons.OK, MessageBoxIcon.Error); } moveToOnlineButton.Enabled = false; RefreshBotList(); }
private void MainWindow_Load(object sender, EventArgs e) { Thread startupThread = new Thread(new ThreadStart(() => { BotRunnerOptions.ReadOptions(); ReadBotsFromConfigFile(); botManager.Start(); })); startupThread.Start(); StartingUpForm form = new StartingUpForm(startupThread); form.Show(); form.BringToFront(); form.StartupFinished += new StartingUpForm.StartupFinishedCallback(() => { updateTimer.Start(); botManager.BalanceBots = BotRunnerOptions.GetValueBool("AutoBotRemoveEnabled"); botManager.OnBotChange += new BotManager.BotChangeCallback(botManager_OnBotChange); botManager.OnTextWrite += new BotManager.PrinterCallback(InsertTextIntoConsole); Visible = true; BringToFront(); RefreshBotList(); }); }
private void OptionsDialog_Load(object sender, EventArgs e) { // Fill default values. botAutoRemoveEnabled.Checked = BotRunnerOptions.GetValueBool("AutoBotRemoveEnabled"); saveButton.Enabled = false; applyButton.Enabled = false; }
private void moveToReserveButton_Click(object sender, EventArgs e) { if (BotRunnerOptions.GetValueBool("AutoBotRemoveEnabled")) { MessageBox.Show(this, "This option is disabled while auto-removing bots is enabled.", "Can't do that.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } object selectedObj = onlineBotsList.SelectedItem; if (selectedObj == null) { moveToReserveButton.Enabled = false; return; } string username = selectedObj.ToString().Split('-')[0].Trim(); botManager.MoveBotToReserve(username); }
/// <summary> /// Sets all options to their default values. /// </summary> public void SetOptions() { botManager.BalanceBots = BotRunnerOptions.GetValueBool("AutoBotRemoveEnabled"); }