Files
eJay/View/Dialogs/AddTransactionView.xaml.cs
Andre Beging 3d2d4851cc Initial Commit
2017-09-11 05:46:57 +02:00

59 lines
2.3 KiB
C#

using DebtMgr.Extensions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using DebtMgr.Model;
namespace DebtMgr.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;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <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);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// <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();
}
}
}