From 947db4409002154c40dc6db6a805edcc82b4e2e4 Mon Sep 17 00:00:00 2001 From: Holger Boerchers Date: Tue, 31 Jul 2018 20:58:55 +0200 Subject: [PATCH] More Prism stuff --- Creator/Helper/SimpleCommandLineParser.cs | 3 ++- Creator/PathFragments.cs | 4 +-- Example/Bootstrapper.cs | 2 +- Example/Example.csproj | 10 +------ Example/MainWindow.xaml | 33 ++++++++++++++++++----- Example/MainWindow.xaml.cs | 10 ------- Example/MainWindowViewModel.cs | 22 +++++++++++++++ Example/Properties/AssemblyInfo.cs | 4 +-- Katteker/Katteker.csproj | 1 - 9 files changed, 55 insertions(+), 34 deletions(-) create mode 100644 Example/MainWindowViewModel.cs diff --git a/Creator/Helper/SimpleCommandLineParser.cs b/Creator/Helper/SimpleCommandLineParser.cs index 655f111..bc9b96c 100644 --- a/Creator/Helper/SimpleCommandLineParser.cs +++ b/Creator/Helper/SimpleCommandLineParser.cs @@ -98,7 +98,8 @@ namespace KattekerCreator.Helper if (textWriter == null) textWriter = Console.Out; LoopProperties(pi => { - var displayName = GetDisplayName(pi) ?? pi.Name; + var displayName = GetDisplayName(pi); + if (displayName == null) return; var value = pi.GetValue(_parsedObject); textWriter.Write(displayName.PadRight(20, ' ')); if (value == null) diff --git a/Creator/PathFragments.cs b/Creator/PathFragments.cs index 9635620..d74a432 100644 --- a/Creator/PathFragments.cs +++ b/Creator/PathFragments.cs @@ -3,7 +3,7 @@ using System.Linq; namespace KattekerCreator { - public class PathFragments + public struct PathFragments { private readonly string[] _fragments; @@ -19,7 +19,5 @@ namespace KattekerCreator public override int GetHashCode() => (_fragments != null ? _fragments.GetHashCode() : 0); public override string ToString() => string.Join(Path.DirectorySeparatorChar.ToString(), _fragments.Take(_fragments.Length - 1)); - - protected bool Equals(PathFragments other) => Equals(_fragments, other._fragments); } } \ No newline at end of file diff --git a/Example/Bootstrapper.cs b/Example/Bootstrapper.cs index eab5baa..e426ae1 100644 --- a/Example/Bootstrapper.cs +++ b/Example/Bootstrapper.cs @@ -10,7 +10,7 @@ namespace Example protected override void InitializeShell() { - (Shell as Window)?.Show(); + Application.Current.MainWindow?.Show(); } } } \ No newline at end of file diff --git a/Example/Example.csproj b/Example/Example.csproj index 53a0543..27f7402 100644 --- a/Example/Example.csproj +++ b/Example/Example.csproj @@ -57,16 +57,11 @@ ..\packages\Prism.Wpf.6.3.0\lib\net45\Prism.Wpf.dll - ..\packages\Prism.Wpf.6.3.0\lib\net45\System.Windows.Interactivity.dll - - - - 4.0 @@ -94,6 +89,7 @@ + Code @@ -128,10 +124,6 @@ {07e2de31-80a0-43da-b307-1ca47cd930a1} Katteker.UserInterface - - {a45e1c59-ba9e-452c-a5e2-50de49d53e92} - Katteker - diff --git a/Example/MainWindow.xaml b/Example/MainWindow.xaml index de75894..288ce56 100644 --- a/Example/MainWindow.xaml +++ b/Example/MainWindow.xaml @@ -3,22 +3,41 @@ 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:i="http://schemas.microsoft.com/expression/2010/interactivity" + xmlns:local="clr-namespace:Example" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:prism="http://prismlibrary.com/" Title="MainWindow" Width="800" Height="450" + d:DataContext="{d:DesignInstance local:MainWindowViewModel}" + prism:ViewModelLocator.AutoWireViewModel="True" Background="#E20074" - ContentRendered="MainWindow_OnContentRendered" mc:Ignorable="d"> + + + + + - - +