private void EditDetailsToolStripMenuItem_Click(object sender, EventArgs e) { var accountNode = tvwObjects.SelectedNode as AccountNode; if (accountNode != null) { var dlg = new frmStorageAccount(); dlg.SelectedAccount = accountNode.Account; if (dlg.ShowDialog() == DialogResult.OK) { _options.Accounts.RemoveWhere(row => row.Name.Equals(dlg.SelectedAccount.Name)); _options.Accounts.Add(dlg.SelectedAccount); _options.Save(); } } }
private void AddAccountToolStripMenuItem_Click(object sender, EventArgs e) { try { var dlg = new frmStorageAccount(); if (dlg.ShowDialog() == DialogResult.OK) { if (_options.Accounts == null) { _options.Accounts = new HashSet <Options.StorageAccount>(); } _options.Accounts.Add(dlg.SelectedAccount); _options.Save(); FillAccounts(); } } catch (Exception exc) { MessageBox.Show(exc.Message); } }