From d9b539f390d40cdfa755efb091fa061030ea8bdf Mon Sep 17 00:00:00 2001 From: kaimbacher Date: Thu, 1 Feb 2018 10:47:47 +0100 Subject: [PATCH 1/3] change to mvvm pattern - add MainViewModel, ViewModelLocator and libs for MvvmLight - ported some methods from MainWindow.xaml.cs to the MainViewModel.cs --- LegendGenerator.App/App.xaml | 24 +- .../LegendGenerator.App.csproj | 26 +- LegendGenerator.App/MainWindow.xaml | 501 +++++++++--------- LegendGenerator.App/MainWindow.xaml.cs | 142 +---- .../ViewModel/MainViewModel.cs | 201 +++++++ .../ViewModel/ViewModelLocator.cs | 56 ++ LegendGenerator.App/app.config | 10 +- LegendGenerator.App/packages.config | 2 + 8 files changed, 580 insertions(+), 382 deletions(-) create mode 100644 LegendGenerator.App/ViewModel/MainViewModel.cs create mode 100644 LegendGenerator.App/ViewModel/ViewModelLocator.cs diff --git a/LegendGenerator.App/App.xaml b/LegendGenerator.App/App.xaml index 7d8c49d..1eb84c4 100644 --- a/LegendGenerator.App/App.xaml +++ b/LegendGenerator.App/App.xaml @@ -1,12 +1,12 @@ - - - - - + + + + + \ No newline at end of file diff --git a/LegendGenerator.App/LegendGenerator.App.csproj b/LegendGenerator.App/LegendGenerator.App.csproj index bfb0317..c022182 100644 --- a/LegendGenerator.App/LegendGenerator.App.csproj +++ b/LegendGenerator.App/LegendGenerator.App.csproj @@ -87,7 +87,23 @@ False + + ..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll + True + + + ..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll + True + + + ..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll + True + + + ..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll + True + False @@ -95,6 +111,10 @@ + + ..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll + True + @@ -115,6 +135,8 @@ + + LegendGeneratorXpsHelpEn.xaml @@ -294,7 +316,9 @@ Designer - + + Designer + diff --git a/LegendGenerator.App/MainWindow.xaml b/LegendGenerator.App/MainWindow.xaml index dd04cdf..0b0d0ef 100644 --- a/LegendGenerator.App/MainWindow.xaml +++ b/LegendGenerator.App/MainWindow.xaml @@ -1,11 +1,16 @@ - + Height="748" Width="740" Loaded="Window_Loaded" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d" + xmlns:vm="clr-namespace:LegendGenerator.App.ViewModel" + Icon="Skins/Images/gba.png" FontSize="12" Closing="Window_Closing"> + @@ -15,41 +20,43 @@ + - + + - - - - + + + + - + - - - - - - - + + + + + + + - - - + + + - - + + - - + + @@ -61,163 +68,164 @@ - - + + -