Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
            });
        }
Ejemplo n.º 3
0
        private void OptionsDialog_Load(object sender, EventArgs e)
        {
            // Fill default values.
            botAutoRemoveEnabled.Checked = BotRunnerOptions.GetValueBool("AutoBotRemoveEnabled");

            saveButton.Enabled  = false;
            applyButton.Enabled = false;
        }
Ejemplo n.º 4
0
        private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OptionsDialog dialog = new OptionsDialog();

            dialog.ShowDialog(this);

            SetOptions();
            BotRunnerOptions.SaveOptions();
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Sets all options to their default values.
 /// </summary>
 public void SetOptions()
 {
     botManager.BalanceBots = BotRunnerOptions.GetValueBool("AutoBotRemoveEnabled");
 }
Ejemplo n.º 7
0
 private void botAutoRemoveEnabled_CheckedChanged(object sender, EventArgs e)
 {
     BotRunnerOptions.SetValue("AutoBotRemoveEnabled", botAutoRemoveEnabled.Checked);
     RegisterChange();
 }
Ejemplo n.º 8
0
 private void applyButton_Click(object sender, EventArgs e)
 {
     BotRunnerOptions.SaveOptions();
     applyButton.Enabled = false;
 }
Ejemplo n.º 9
0
 private void saveButton_Click(object sender, EventArgs e)
 {
     BotRunnerOptions.SaveOptions();
     Close();
 }
Ejemplo n.º 10
0
 private void cancelButton_Click(object sender, EventArgs e)
 {
     BotRunnerOptions.ReadOptions();
     Close();
 }