/// <summary> /// Creates a new instance of AccountEditorWindow to edit the currently selected account /// </summary> private void EditAccount() { if (Application.Current.Windows.OfType<MetroWindow>().Any(x => x.Title == "AccountEditorWindow") || (AccountList.SelectedItem == null)) return; //Check if a editor window window is already open or no account is selected Account editedAccount = (Account) AccountList.SelectedItem; AccountEditorWindow accountEditorWindow = new AccountEditorWindow(false, editedAccount) {Owner = this}; if (accountEditorWindow.ShowDialog() != true) return; _needsSaving = true; SaveInfo.Content = ""; FilterDataGrid(); }
/// <summary> /// Creates a new instance of AccountEditorWindow to create a new account /// </summary> private void CreateNewAccount() { if (Application.Current.Windows.OfType<MetroWindow>().Any(x => x.Title == "AccountEditorWindow")) return; //Check if a account editor window is already open Account newAccount = new Account(); AccountEditorWindow accountEditorWindow = new AccountEditorWindow(true, newAccount) {Owner = this}; if (accountEditorWindow.ShowDialog() != true) return; _needsSaving = true; SaveInfo.Content = ""; AccountsObservableCollection.Add(accountEditorWindow.AccountBeingEdited); }