private void listBots_SelectedIndexChanged(object sender, EventArgs e) { try { ConfigurationBot bot = (ConfigurationBot)this.listBots.SelectedItem; if (bot == null) { this.CleanEditMode(); this.SwitchTools(false); return; } this.txtAccount.Text = bot.Account; this.txtPassword.Text = string.Empty; for (int i = 0; i < bot.Password.Length; i++) { this.txtPassword.Text += "*"; } this.txtCharacter.Text = bot.Character; this.cbDimension.Text = bot.Dimension; this.txtAdmin.Text = bot.Admin; this.cbEnabled.Checked = bot.Enabled; this.WorkingBot = bot; this.SwitchTools(true); } catch { } }
private void btnNew_Click(object sender, EventArgs e) { this.WorkingNew = true; this.WorkingBot = null; this.CleanEditMode(); this.SwitchMode(true); }
private void btnAccept_Click(object sender, EventArgs e) { if (this.txtAccount.Text == string.Empty) { MessageBox.Show("Missing Account Name", "Error"); return; } if (this.txtPassword.Text == string.Empty) { MessageBox.Show("Missing Account Password", "Error"); return; } if (this.txtCharacter.Text == string.Empty) { MessageBox.Show("Missing Character Name", "Error"); return; } if (this.cbDimension.Text == string.Empty) { MessageBox.Show("Missing Dimension", "Error"); return; } if (this.txtAdmin.Text == string.Empty) { MessageBox.Show("Missing Bot Admin", "Error"); return; } if (this.WorkingNew) { ConfigurationBot bot = new ConfigurationBot(); bot.Account = this.txtAccount.Text; bot.Password = this.txtPassword.Text; bot.Character = this.txtCharacter.Text; bot.Admin = this.txtAdmin.Text; bot.Dimension = this.cbDimension.Text; bot.Enabled = this.cbEnabled.Checked; this.listBots.Items.Add(bot); this.CleanEditMode(); } else { this.WorkingBot.Account = this.txtAccount.Text; this.WorkingBot.Password = this.txtPassword.Text; this.WorkingBot.Character = this.txtCharacter.Text; this.WorkingBot.Admin = this.txtAdmin.Text; this.WorkingBot.Dimension = this.cbDimension.Text; this.WorkingBot.Enabled = this.cbEnabled.Checked; if (this.listBots.SelectedIndex >= 0) { this.listBots.Items[this.listBots.SelectedIndex] = this.WorkingBot; } } this.SwitchMode(false); }
public SlavesForm(ConfigurationBot bot) { InitializeComponent(); this.Bot = bot; if (bot != null && bot.Slaves != null) { foreach (ConfigurationSlave slave in bot.Slaves) { this.listBots.Items.Add(slave); } } }
private void btnSlaves_Click(object sender, EventArgs e) { try { ConfigurationBot bot = (ConfigurationBot)this.listBots.SelectedItem; if (bot == null) { return; } SlavesForm form = new SlavesForm(bot); form.ShowDialog(); form.Dispose(); } catch { } }
private void btnDelete_Click(object sender, EventArgs e) { try { ConfigurationBot bot = (ConfigurationBot)this.listBots.SelectedItem; if (bot == null) { return; } if (MessageBox.Show("Are you sure you wish to remove " + bot.ToString() + "?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.listBots.Items.Remove(bot); } } catch { } }
private void btnEdit_Click(object sender, EventArgs e) { try { ConfigurationBot bot = (ConfigurationBot)this.listBots.SelectedItem; if (bot == null) { return; } this.WorkingNew = false; this.WorkingBot = bot; this.txtPassword.Text = bot.Password; this.SwitchMode(true); } catch { } }