private void buttonAddAccount_Click(object sender, EventArgs e) { var accountConfig = AccountConfigDialog.GetNewAccountInfo(this); if (accountConfig != null) { appState.AddAccountConfig(accountConfig); } }
public static AccountConfig GetNewAccountInfo(IWin32Window dialogOwner) { using (var dialog = new AccountConfigDialog()) { if (dialog.ShowDialog(dialogOwner) == DialogResult.OK) { var accountInfo = new AccountInfo(dialog.GetAccountType(), dialog.textBoxAccountName.Text, dialog.textBoxInstituteName.Text, dialog.textBoxAccountName.Text, false); var accountConfig = new AccountConfig(accountInfo); return(accountConfig); } else { return(null); } } }