private void btnSave_Click(object sender, EventArgs e) { // Create the password dialog ConfigPassword passwordDlg = new ConfigPassword(); // Display the password dialog if (passwordDlg.ShowDialog() == DialogResult.OK) { // Write the settings to the file m_coreSettings.WriteSettings(passwordDlg.txtPassword.Text); } }
private void ConfigureBots_Load(object sender, EventArgs e) { // Create the password dialog ConfigPassword passwordDlg = new ConfigPassword(); passwordDlg.ShowDialog(); m_coreSettings = new CoreSettings(passwordDlg.txtPassword.Text); if (m_coreSettings.ConfiguredBots.Count == 0) { BotSettings settings = new BotSettings(); // Force the initial bot to autoload settings.chkLoad.Checked = true; settings.chkLoad.Enabled = false; // Display the bot settings dilaog if (settings.ShowDialog() == DialogResult.OK) { // Add the new bot to the configuration BattleCore.Settings.BotSettings bot = new BattleCore.Settings.BotSettings(); bot.BotDirectory = settings.txtUserName.Text; bot.AutoLoad = settings.chkLoad.Checked; bot.SqlConnectString = settings.txtSqlConnection.Text; bot.SessionSettings.UserName = settings.txtUserName.Text; bot.SessionSettings.Password = settings.txtPassword.Text; bot.SessionSettings.StaffPassword = settings.txtStaffPassword.Text; bot.SessionSettings.ServerAddress = settings.txtServerAddress.Text; bot.SessionSettings.ServerPort = Convert.ToUInt16(settings.txtServerPort.Text); bot.SessionSettings.InitialArena = settings.txtInitialArena.Text; m_coreSettings.ConfiguredBots.Add(bot); // Refresh the list control UpdateListView(); } else { Application.Exit(); } } else { // Update the list view UpdateListView(); } }