Files
eJay/View/Dialogs/AddTransactionView.xaml.cs
2019-01-06 16:12:11 +01:00

65 lines
2.4 KiB
C#

using eJay.Extensions;
using System.Windows;
using System.Windows.Input;
using eJay.Model;
namespace eJay.View.Dialogs
{
/// <summary>
/// Interaktionslogik für AddTransactionView.xaml
/// </summary>
public partial class AddTransactionView : Window
{
public AddTransactionView(TransactionType transactionType, Person preselectedPerson)
{
InitializeComponent();
this.CenterOnParent();
App.Locator.AddTransactionView.ClearView();
App.Locator.AddTransactionView.DialogMode = transactionType;
App.Locator.AddTransactionView.PreselectedPerson = preselectedPerson;
App.Locator.AddTransactionView.SetModeSpecificStrings();
App.Locator.AddTransactionView.RequestClose += (s, e) => Close();
DataContext = App.Locator.AddTransactionView;
}
#region TextBox_OnKeyUp()
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary> Event handler. Called by TextBox for on key up events. </summary>
///
/// <remarks> Andre Beging, 09.09.2017. </remarks>
///
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Key event information. </param>
////////////////////////////////////////////////////////////////////////////////////////////////////
private void TextBox_OnKeyUp(object sender, KeyEventArgs e)
{
if (e.Key.Equals(Key.Enter) || e.Key.Equals(Key.Return))
App.Locator.AddTransactionView.AddTransactionButtonClickCommand.Execute(null);
}
#endregion
#region Window_OnKeyUp()
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <summary> Event handler. Called by Window for on key up events. </summary>
///
/// <remarks> Andre Beging, 09.09.2017. </remarks>
///
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Key event information. </param>
////////////////////////////////////////////////////////////////////////////////////////////////////
private void Window_OnKeyUp(object sender, KeyEventArgs e)
{
if (e.Key.Equals(Key.Escape))
Close();
}
#endregion
}
}