Added Edit Transaction
This commit is contained in:
@@ -27,6 +27,8 @@ namespace DebtMgr.View.Dialogs
|
||||
DataContext = App.Locator.AddTransactionView;
|
||||
}
|
||||
|
||||
#region TextBox_OnKeyUp()
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// <summary> Event handler. Called by TextBox for on key up events. </summary>
|
||||
///
|
||||
@@ -41,6 +43,9 @@ namespace DebtMgr.View.Dialogs
|
||||
App.Locator.AddTransactionView.AddTransactionButtonClickCommand.Execute(null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Window_OnKeyUp()
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// <summary> Event handler. Called by Window for on key up events. </summary>
|
||||
///
|
||||
@@ -54,5 +59,7 @@ namespace DebtMgr.View.Dialogs
|
||||
if (e.Key.Equals(Key.Escape))
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
49
View/Dialogs/EditTransactionDialogView.xaml
Normal file
49
View/Dialogs/EditTransactionDialogView.xaml
Normal file
@@ -0,0 +1,49 @@
|
||||
<Window x:Class="DebtMgr.View.Dialogs.EditTransactionDialogView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:DebtMgr.View.Dialogs"
|
||||
xmlns:currencyTextBoxControl="clr-namespace:CurrencyTextBoxControl;assembly=CurrencyTextBoxControl"
|
||||
mc:Ignorable="d"
|
||||
Icon="../../Content/moneybag.ico"
|
||||
Name="EditTransactionViewWindow"
|
||||
Title="{Binding WindowTitle}" Height="300" Width="300"
|
||||
KeyUp="Window_KeyUp">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Orientation="Vertical">
|
||||
<Label Content="{Binding ElementName=EditTransactionViewWindow, Path=Title}" FontWeight="Bold" FontSize="18"></Label>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Orientation="Vertical" Margin="10 0">
|
||||
<currencyTextBoxControl:CurrencyTextBox KeyUp="TextBox_OnKeyUp" Name="Amount" Number="{Binding AmountTextBoxText}" StringFormat="0.00 Eur" FontSize="16" Margin="0 0 0 -5"></currencyTextBoxControl:CurrencyTextBox>
|
||||
<Label Content="Amount in EUR"></Label>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="2" Orientation="Vertical" Margin="10 0">
|
||||
<TextBox KeyUp="TextBox_OnKeyUp" Name="Description" Text="{Binding DescriptionTextBoxText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="0 0 0 -5"></TextBox>
|
||||
<Label Content="Description"></Label>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="3" Orientation="Vertical" Margin="10 0">
|
||||
<DatePicker KeyUp="TextBox_OnKeyUp" SelectedDate="{Binding DatePickerSelectedDate}"></DatePicker>
|
||||
<Label Content="Date"></Label>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="4" Orientation="Vertical" Margin="10 0">
|
||||
<Label Content="{Binding PersonNameLabelContent}" FontSize="14"></Label>
|
||||
<Label Content="Person"></Label>
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="1" Content="Save" FontSize="14" Padding="5" Margin="10 -10" Command="{Binding SaveTransactionButtonClickCommand}"></Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
72
View/Dialogs/EditTransactionDialogView.xaml.cs
Normal file
72
View/Dialogs/EditTransactionDialogView.xaml.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using DebtMgr.Extensions;
|
||||
|
||||
namespace DebtMgr.View.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für EditTransactionDialogView.xaml
|
||||
/// </summary>
|
||||
public partial class EditTransactionDialogView : Window
|
||||
{
|
||||
public EditTransactionDialogView(Guid transactionId)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.CenterOnParent();
|
||||
|
||||
App.Locator.EditTransactionDialogView.RequestClose += (s, e) => Close();
|
||||
App.Locator.EditTransactionDialogView.ClearView();
|
||||
App.Locator.EditTransactionDialogView.TransactionId = transactionId;
|
||||
App.Locator.EditTransactionDialogView.LoadTransaction();
|
||||
|
||||
DataContext = App.Locator.EditTransactionDialogView;
|
||||
}
|
||||
|
||||
#region Window_KeyUp()
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// <summary> Event handler. Called by Window for key up events. </summary>
|
||||
///
|
||||
/// <remarks> Andre Beging, 12.09.2017. </remarks>
|
||||
///
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Key event information. </param>
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private void Window_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key.Equals(Key.Escape))
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TextBox_OnKeyUp()
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// <summary> Event handler. Called by TextBox for on key up events. </summary>
|
||||
///
|
||||
/// <remarks> Andre Beging, 12.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.EditTransactionDialogView.SaveTransactionButtonClickCommand.Execute(null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user