using System.Windows; using System.Windows.Input; using DebtMgr.Extensions; namespace DebtMgr.View.Dialogs { /// /// Interaktionslogik für NewPersonDialogView.xaml /// public partial class NewPersonDialogView : Window { public NewPersonDialogView() { InitializeComponent(); this.CenterOnParent(); App.Locator.NewPersonDialogView.RequestClose += (s, e) => Close(); DataContext = App.Locator.NewPersonDialogView; FirstNameTextBox.Focus(); } //////////////////////////////////////////////////////////////////////////////////////////////////// /// Event handler. Called by TextBox for on key up events. /// /// Andre Beging, 09.09.2017. /// /// Source of the event. /// Key event information. //////////////////////////////////////////////////////////////////////////////////////////////////// private void TextBox_OnKeyUp(object sender, KeyEventArgs e) { if (e.Key.Equals(Key.Enter) || e.Key.Equals(Key.Return)) App.Locator.NewPersonDialogView.CreatePersonButtonClickCommand.Execute(null); } //////////////////////////////////////////////////////////////////////////////////////////////////// /// Event handler. Called by Window for key up events. /// /// Andre Beging, 09.09.2017. /// /// Source of the event. /// Key event information. //////////////////////////////////////////////////////////////////////////////////////////////////// private void Window_KeyUp(object sender, KeyEventArgs e) { if (e.Key.Equals(Key.Escape)) Close(); } } }