private void AddAccountButton_Click(object sender, EventArgs e) { AccountViewForm acfr = new AccountViewForm(null); ////TODO: Weak References? acfr.AccountEditComplited += new EventHandler <EventArgs>((account, _e) => { WebPanelAccount.AccountManager.ManagerInstance.Add((WebPanelAccount.Account)account); AccountManager.SaveAccounts(Setting.AccountFileName); }); acfr.ShowDialog(); }
private void EditAccountButton_Click(object sender, EventArgs e) { if (this.AccountListView.SelectedIndices.Count > 0) { int index = this.AccountListView.SelectedIndices[0]; AccountViewForm acfr = new AccountViewForm(AccountManager.ManagerInstance[index]); acfr.AccountEditComplited += new EventHandler <EventArgs>((account, _e) => { WebPanelAccount.AccountManager.ManagerInstance[index] = (Account)account; AccountManager.SaveAccounts(Setting.AccountFileName); }); acfr.ShowDialog(); } }