private void ButtonAddAccount_Click(object sender, RoutedEventArgs e) { AddAccountWindow window = new AddAccountWindow(); window.Owner = this; window.ExistingAccounts = Settings.Accounts.Select(acc => acc.AccountName).ToList(); if (window.ShowDialog() == true) { Settings.AddAccount(window.AccountName); Settings.SetActiveAccount(window.AccountName); UpdateAccountsComboBox(); } }
private void AddNewAccount_Clicked(object sender, RoutedEventArgs e) { AddAccountWindow newAccountWindow = new AddAccountWindow(); var dialogResult = newAccountWindow.ShowDialog(); if (!dialogResult.HasValue || !dialogResult.Value) { newAccountWindow.Close(); } else { SaveAccount( newAccountWindow.tbOwner.Text, newAccountWindow.tbLivingSpace.Text, AddAccountWindow.selectedHouse.Id, newAccountWindow.tbApartmentNumber.Text); MessageBox.Show("New personal account created successfully"); } }
private void _button添加账户_Click(object sender, RoutedEventArgs e) { AddAccountWindow aaf = new AddAccountWindow(); HwndSource winformWindow = (HwndSource.FromDependencyObject(this) as HwndSource); if (winformWindow != null) { new WindowInteropHelper(aaf) { Owner = winformWindow.Handle }; } aaf.ShowDialog(); // if (aaf.DialogResult.Value) { using (StatementContext statement = new StatementContext(typeof(Account))) { InitializeAccountList(); } } }