private void BtnAddClick(object sender, EventArgs e) { var key = GetNextKey(); var frm = new ContentServerForm { Account = _accounts[_activeEmail], Key = key }; if (frm.ShowDialog(this) != DialogResult.OK) return; //if we don't have a password try to get it if (string.IsNullOrEmpty(frm.Account.Configurations[key].Password) && !string.IsNullOrEmpty(frm.txtServer.Text) && !string.IsNullOrEmpty(frm.udPort.Text)) { frm.Account.Configurations[key].Password = FetchPassword(frm.Account, frm.txtServer.Text, frm.udPort.Text); } //store the new configuration _accounts[_activeEmail] = frm.Account; //load it LoadConfigs(frm.Account); //select this one SelectConfig(key); }
private void BtnEditClick(object sender, EventArgs e) { if (lvwConfig.SelectedItems.Count == 0) return; var key = int.Parse(lvwConfig.SelectedItems[0].Name); var account = _accounts[_activeEmail]; var config = account.Configurations[key]; if (string.IsNullOrEmpty(config.Password) && !string.IsNullOrEmpty(config.Server) && !string.IsNullOrEmpty(config.Port)) { account.Configurations[key].Password = FetchPassword(account, config.Server, config.Port); } var frm = new ContentServerForm { Account = _accounts[_activeEmail], Key = key }; if (frm.ShowDialog(this) != DialogResult.OK) return; //if we still don't have a password try to get it if (string.IsNullOrEmpty(frm.Account.Configurations[key].Password) && !string.IsNullOrEmpty(frm.txtServer.Text) && !string.IsNullOrEmpty(frm.udPort.Text)) { frm.Account.Configurations[key].Password = FetchPassword(frm.Account, frm.txtServer.Text, frm.udPort.Text); } //store the new configuration _accounts[_activeEmail] = frm.Account; //load it LoadConfigs(frm.Account); //select this one SelectConfig(key); }