private void addButton_Click(object sender, RoutedEventArgs e) { var editor = new AccountEditor(); editor.ShowDialog(); if (editor.EditedAccount != null) { accounts.Add(editor.EditedAccount); saveAccounts(); } }
private void editButton_Click(object sender, RoutedEventArgs e) { if (listBox.SelectedItem == null) { MessageBox.Show("Please select an account!", "Xenon"); return; } var account = (Account)listBox.SelectedItem; var editor = new AccountEditor(account); editor.ShowDialog(); if (editor.EditedAccount != null) { accounts[accounts.IndexOf(account)] = editor.EditedAccount; saveAccounts(); } }