public bool CreateNewAccountForm(string name, PluginContext context) { using (var form = new AccountForm(name)) { if (form.ShowDialog() == DialogResult.OK) { var path = GetPath(form.AccountName); if (File.Exists(path)) { var answer = MessageBox.Show( PluginResources.ReplaceAccount, PluginResources.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question ); if (answer != DialogResult.Yes) { return(false); } } Save(path, form.AccountInfo); return(true); } } return(false); }
public bool EditAccountForm(string name, PluginContext context) { var path = GetPath(name); if (File.Exists(path)) { var account = AccountInfo.Parse(File.ReadAllLines(path, Encoding.Unicode)); using (var form = new AccountForm(name, account)) { if (form.ShowDialog() == DialogResult.OK) { Save(path, form.AccountInfo); return(true); } } } return(false); }