diff --git a/DebtMgr.csproj b/DebtMgr.csproj
index 9157972..9dffdd9 100644
--- a/DebtMgr.csproj
+++ b/DebtMgr.csproj
@@ -39,6 +39,15 @@
Content\money_green.ico
+
+ false
+
+
+ sgKey.snk
+
+
+ false
+
packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll
@@ -100,6 +109,7 @@
+
@@ -172,6 +182,7 @@
SettingsSingleFileGenerator
Settings.Designer.cs
+
diff --git a/Helper/PrintHelper.cs b/Helper/PrintHelper.cs
new file mode 100644
index 0000000..6d616af
--- /dev/null
+++ b/Helper/PrintHelper.cs
@@ -0,0 +1,62 @@
+using System.IO;
+using System.Windows;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+
+namespace DebtMgr.Helper
+{
+ public class PrintHelper
+ {
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Saves an using encoder.
+ ///
+ /// Andre Beging, 13.09.2017.
+ ///
+ /// Filename of the file.
+ /// The element.
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ public static void SaveUsingEncoder(string fileName, FrameworkElement uiElement)
+ {
+ var encoder = new PngBitmapEncoder();
+
+ var height = (int)uiElement.ActualHeight;
+ var width = (int)uiElement.ActualWidth;
+
+ // These two line of code make sure that you get completed visual bitmap.
+ // In case your Framework Element is inside the scroll viewer then some part which is not
+ // visible gets clip.
+ uiElement.Measure(new Size(width, height));
+ uiElement.Arrange(new Rect(new Point(), new Point(width, height)));
+
+ var bitmap = new RenderTargetBitmap(width,
+
+ height,
+ 96, // These decides the dpi factors
+ 96,// The can be changed when we'll have preview options.
+ PixelFormats.Pbgra32);
+ bitmap.Render(uiElement);
+
+ SaveUsingBitmapTargetRenderer(fileName, bitmap, encoder);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// Saves an using bitmap target renderer.
+ ///
+ /// Andre Beging, 13.09.2017.
+ ///
+ /// Filename of the file.
+ /// The render target bitmap.
+ /// The bitmap encoder.
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ private static void SaveUsingBitmapTargetRenderer(string fileName, RenderTargetBitmap renderTargetBitmap, BitmapEncoder bitmapEncoder)
+ {
+ var frame = BitmapFrame.Create(renderTargetBitmap);
+ bitmapEncoder.Frames.Add(frame);
+ // Save file .
+ using (var stream = File.Create(fileName))
+ {
+ bitmapEncoder.Save(stream);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/View/Dialogs/AddTransactionView.xaml b/View/Dialogs/AddTransactionView.xaml
index ca4ceb0..b9a68ed 100644
--- a/View/Dialogs/AddTransactionView.xaml
+++ b/View/Dialogs/AddTransactionView.xaml
@@ -7,7 +7,7 @@
mc:Ignorable="d"
Icon="{Binding WindowIcon}"
Name="AddTransactionViewWindow"
- Title="{Binding WindowTitle}" Height="300" Width="300"
+ Title="{Binding WindowTitle}" Height="325" Width="300"
KeyUp="Window_OnKeyUp">
@@ -21,29 +21,29 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
+
diff --git a/View/MainView.xaml b/View/MainView.xaml
index 1cc9982..8831618 100644
--- a/View/MainView.xaml
+++ b/View/MainView.xaml
@@ -61,7 +61,7 @@
-
+
@@ -88,6 +88,8 @@
+
+
@@ -130,7 +132,7 @@
-
+
diff --git a/View/MainView.xaml.cs b/View/MainView.xaml.cs
index 0044795..102c717 100644
--- a/View/MainView.xaml.cs
+++ b/View/MainView.xaml.cs
@@ -1,5 +1,9 @@
-using System.Windows;
+using System.IO;
+using System.Windows;
using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using DebtMgr.Helper;
namespace DebtMgr.View
{
@@ -63,5 +67,51 @@ namespace DebtMgr.View
}
#endregion
+
+ #region PersonListView_OnMouseDoubleClick()
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ ///
+ /// Event handler. Called by PersonListView for on mouse double click events.
+ ///
+ ///
+ /// Andre Beging, 13.09.2017.
+ ///
+ /// Source of the event.
+ /// Mouse button event information.
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ private void PersonListView_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ App.Locator.MainView.EditPersonContextMenuCommand.Execute(null);
+ }
+
+ #endregion
+
+ #region TransactionHistoryListView_OnMouseDoubleClick()
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ ///
+ /// Event handler. Called by TransactionHistoryListView for on mouse double click events.
+ ///
+ ///
+ /// Andre Beging, 13.09.2017.
+ ///
+ /// Source of the event.
+ /// Mouse button event information.
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ private void TransactionHistoryListView_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ App.Locator.MainView.EditTransactionContextMenuCommand.Execute(null);
+ }
+
+ #endregion
+
+ private void PrintContextMenu_OnClick(object sender, RoutedEventArgs e)
+ {
+ //var targetElement = TransactionHistoryListView;
+
+ //PrintHelper.SaveUsingEncoder("test.png", targetElement);
+ return;
+ }
}
}
diff --git a/ViewModel/MainViewModel.cs b/ViewModel/MainViewModel.cs
index 5895389..8e44cc8 100644
--- a/ViewModel/MainViewModel.cs
+++ b/ViewModel/MainViewModel.cs
@@ -521,7 +521,7 @@ namespace DebtMgr.ViewModel
PersonListViewItemSource = personList;
var overallBalance = personList.Sum(x => x.Total);
- OverallBalanceLabel = overallBalance.ToString();
+ OverallBalanceLabel = string.Format("{0:0.00}", overallBalance);
AddChargeContextMenuCommand.RaiseCanExecuteChanged();
AddDepositContextMenuCommand.RaiseCanExecuteChanged();
@@ -553,7 +553,7 @@ namespace DebtMgr.ViewModel
DetailViewHeaderLabelContent = string.Format("{0} {1}", PersonListViewSelectedItem.FirstName,
PersonListViewSelectedItem.LastName);
- DetailViewBalanceLabel = PersonListViewSelectedItem.Total.ToString();
+ DetailViewBalanceLabel = string.Format("{0:0.00}", PersonListViewSelectedItem.Total);
TransactionHistoryListViewItemSource = PersonListViewSelectedItem.Transactions.OrderByDescending(x => x.Time).ToList();
}
diff --git a/sgKey.snk b/sgKey.snk
new file mode 100644
index 0000000..2ef4db8
Binary files /dev/null and b/sgKey.snk differ