From c9967dd789989455c5bab3f868836d158c42a365 Mon Sep 17 00:00:00 2001 From: Alden Alexander Date: Mon, 12 Jul 2021 18:46:26 -0500 Subject: [PATCH 1/2] Update all packages. --- src/Forge.Application.Demo/App.xaml | 43 ++++++++------- .../Forge.Application.Demo.csproj | 12 +++-- .../Views/AboutView.xaml | 2 +- .../Views/ContactView.xaml | 2 +- .../Controls/MaterialRoutesWindow.xaml | 1 - .../Forge.Application.csproj | 8 +-- .../Infrastructure/Internal/PaletteService.cs | 52 +++++++++---------- .../Forge.Application.Template.csproj | 6 +-- 8 files changed, 69 insertions(+), 57 deletions(-) diff --git a/src/Forge.Application.Demo/App.xaml b/src/Forge.Application.Demo/App.xaml index 553ac7b..b4a660d 100644 --- a/src/Forge.Application.Demo/App.xaml +++ b/src/Forge.Application.Demo/App.xaml @@ -6,34 +6,41 @@ - + + + + + - - - - - - - - - - - + + + + + + + + + + + + + - - - - + + + + + + + diff --git a/src/Forge.Application.Demo/Forge.Application.Demo.csproj b/src/Forge.Application.Demo/Forge.Application.Demo.csproj index 91b3493..0cc4d0b 100644 --- a/src/Forge.Application.Demo/Forge.Application.Demo.csproj +++ b/src/Forge.Application.Demo/Forge.Application.Demo.csproj @@ -34,9 +34,15 @@ 4 - - - + + + + + 0.1.7 + + + 1.0.1 + diff --git a/src/Forge.Application.Demo/Views/AboutView.xaml b/src/Forge.Application.Demo/Views/AboutView.xaml index 4f129a7..d5bb103 100644 --- a/src/Forge.Application.Demo/Views/AboutView.xaml +++ b/src/Forge.Application.Demo/Views/AboutView.xaml @@ -11,7 +11,7 @@ VerticalAlignment="Stretch"> - + - + diff --git a/src/Forge.Application/Controls/MaterialRoutesWindow.xaml b/src/Forge.Application/Controls/MaterialRoutesWindow.xaml index 90cd5ff..a6e960f 100644 --- a/src/Forge.Application/Controls/MaterialRoutesWindow.xaml +++ b/src/Forge.Application/Controls/MaterialRoutesWindow.xaml @@ -18,7 +18,6 @@ IsDesignTimeCreatable=False}" internal:AttachedProperties.InputBindingsSource="{Binding Routes.Current.RouteConfig.KeyBindings}" Background="{DynamicResource MaterialDesignPaper}" - EnableDWMDropShadow="True" FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto" TextElement.FontSize="{Binding FontSize, Mode=OneWay}" diff --git a/src/Forge.Application/Forge.Application.csproj b/src/Forge.Application/Forge.Application.csproj index b05a86d..5235f70 100644 --- a/src/Forge.Application/Forge.Application.csproj +++ b/src/Forge.Application/Forge.Application.csproj @@ -7,12 +7,12 @@ - - - + + + - 4.9.2 + 5.10.0 all runtime; build; native; contentfiles; analyzers diff --git a/src/Forge.Application/Infrastructure/Internal/PaletteService.cs b/src/Forge.Application/Infrastructure/Internal/PaletteService.cs index ecaef3a..f81b5dc 100644 --- a/src/Forge.Application/Infrastructure/Internal/PaletteService.cs +++ b/src/Forge.Application/Infrastructure/Internal/PaletteService.cs @@ -16,36 +16,36 @@ internal class PaletteService : IPaletteService public void RefreshTheme() { - new PaletteHelper().SetLightDark(this.DarkMode); + //new PaletteHelper().SetLightDark(this.DarkMode); } public void RefreshPalette() { - var paletteHelper = new PaletteHelper(); - if (this.DarkMode) - { - if (this.DarkModePrimary != null) - { - paletteHelper.ReplacePrimaryColor(this.DarkModePrimary); - } - - if (this.DarkModeAccent != null) - { - paletteHelper.ReplaceAccentColor(this.DarkModeAccent); - } - } - else - { - if (this.LightModePrimary != null) - { - paletteHelper.ReplacePrimaryColor(this.LightModePrimary); - } - - if (this.LightModeAccent != null) - { - paletteHelper.ReplaceAccentColor(this.LightModeAccent); - } - } + //var paletteHelper = new PaletteHelper(); + //if (this.DarkMode) + //{ + // if (this.DarkModePrimary != null) + // { + // paletteHelper.ReplacePrimaryColor(this.DarkModePrimary); + // } + + // if (this.DarkModeAccent != null) + // { + // paletteHelper.ReplaceAccentColor(this.DarkModeAccent); + // } + //} + //else + //{ + // if (this.LightModePrimary != null) + // { + // paletteHelper.ReplacePrimaryColor(this.LightModePrimary); + // } + + // if (this.LightModeAccent != null) + // { + // paletteHelper.ReplaceAccentColor(this.LightModeAccent); + // } + //} } } } diff --git a/tools/Forge.Application.Template/Forge.Application.Template.csproj b/tools/Forge.Application.Template/Forge.Application.Template.csproj index f2922bf..f314913 100644 --- a/tools/Forge.Application.Template/Forge.Application.Template.csproj +++ b/tools/Forge.Application.Template/Forge.Application.Template.csproj @@ -37,9 +37,9 @@ 1.0.1 - - - + + + From cbedcd1f036a4fc14ff8ef68b7a34604a0461bca Mon Sep 17 00:00:00 2001 From: Alden Alexander Date: Mon, 12 Jul 2021 18:55:52 -0500 Subject: [PATCH 2/2] Fix PaletteService to work with new MaterialDesign library. --- .../Infrastructure/Internal/PaletteService.cs | 60 +++++++++++-------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/src/Forge.Application/Infrastructure/Internal/PaletteService.cs b/src/Forge.Application/Infrastructure/Internal/PaletteService.cs index f81b5dc..4f322c7 100644 --- a/src/Forge.Application/Infrastructure/Internal/PaletteService.cs +++ b/src/Forge.Application/Infrastructure/Internal/PaletteService.cs @@ -1,5 +1,6 @@ namespace Forge.Application.Infrastructure.Internal { + using System.Windows.Media; using MaterialDesignThemes.Wpf; internal class PaletteService : IPaletteService @@ -16,36 +17,43 @@ internal class PaletteService : IPaletteService public void RefreshTheme() { - //new PaletteHelper().SetLightDark(this.DarkMode); + var paletteHelper = new PaletteHelper(); + var theme = paletteHelper.GetTheme(); + IBaseTheme baseTheme = DarkMode ? new MaterialDesignDarkTheme() : (IBaseTheme)new MaterialDesignLightTheme(); + theme.SetBaseTheme(baseTheme); + paletteHelper.SetTheme(theme); } public void RefreshPalette() { - //var paletteHelper = new PaletteHelper(); - //if (this.DarkMode) - //{ - // if (this.DarkModePrimary != null) - // { - // paletteHelper.ReplacePrimaryColor(this.DarkModePrimary); - // } - - // if (this.DarkModeAccent != null) - // { - // paletteHelper.ReplaceAccentColor(this.DarkModeAccent); - // } - //} - //else - //{ - // if (this.LightModePrimary != null) - // { - // paletteHelper.ReplacePrimaryColor(this.LightModePrimary); - // } - - // if (this.LightModeAccent != null) - // { - // paletteHelper.ReplaceAccentColor(this.LightModeAccent); - // } - //} + var paletteHelper = new PaletteHelper(); + var theme = paletteHelper.GetTheme(); + if (this.DarkMode) + { + if (this.DarkModePrimary != null) + { + theme.SetPrimaryColor((Color)ColorConverter.ConvertFromString(this.DarkModePrimary)); + } + + if (this.DarkModeAccent != null) + { + theme.SetSecondaryColor((Color)ColorConverter.ConvertFromString(this.DarkModeAccent)); + } + } + else + { + if (this.LightModePrimary != null) + { + theme.SetPrimaryColor((Color)ColorConverter.ConvertFromString(this.LightModePrimary)); + } + + if (this.LightModeAccent != null) + { + theme.SetSecondaryColor((Color)ColorConverter.ConvertFromString(this.LightModeAccent)); + } + } + + paletteHelper.SetTheme(theme); } } }