From 62f2e6fb8e678b20e819ecb5b5ce4081eb80b36b Mon Sep 17 00:00:00 2001 From: Clint Rutkas Date: Wed, 11 Nov 2020 14:14:34 -0800 Subject: [PATCH] removed mahapps dep, did lighter weight ControlzEx. Need to add these to WSX --- .../tests/Properties/AppFixture.cs | 1 + .../imageresizer/ui/ImageResizerUI.csproj | 2 +- src/modules/imageresizer/ui/Themes/Dark.xaml | 7 +----- .../imageresizer/ui/Themes/HighContrast1.xaml | 7 +----- .../imageresizer/ui/Themes/HighContrast2.xaml | 7 +----- .../ui/Themes/HighContrastBlack.xaml | 9 ++----- .../ui/Themes/HighContrastWhite.xaml | 7 +----- src/modules/imageresizer/ui/Themes/Light.xaml | 7 +----- .../Utilities/CustomLibraryThemeProvider.cs | 24 +++++++++++++++++++ .../imageresizer/ui/Utilities/ThemeManager.cs | 14 +++++------ 10 files changed, 40 insertions(+), 45 deletions(-) create mode 100644 src/modules/imageresizer/ui/Utilities/CustomLibraryThemeProvider.cs diff --git a/src/modules/imageresizer/tests/Properties/AppFixture.cs b/src/modules/imageresizer/tests/Properties/AppFixture.cs index 2361b76af4..433a869cb1 100644 --- a/src/modules/imageresizer/tests/Properties/AppFixture.cs +++ b/src/modules/imageresizer/tests/Properties/AppFixture.cs @@ -26,6 +26,7 @@ namespace ImageResizer.Properties { if (disposing) { + _imageResizerApp.Dispose(); _imageResizerApp = null; } diff --git a/src/modules/imageresizer/ui/ImageResizerUI.csproj b/src/modules/imageresizer/ui/ImageResizerUI.csproj index 54fb3f17be..2d95951209 100644 --- a/src/modules/imageresizer/ui/ImageResizerUI.csproj +++ b/src/modules/imageresizer/ui/ImageResizerUI.csproj @@ -61,7 +61,7 @@ - + all diff --git a/src/modules/imageresizer/ui/Themes/Dark.xaml b/src/modules/imageresizer/ui/Themes/Dark.xaml index 7baf11213e..f0d0cb1339 100644 --- a/src/modules/imageresizer/ui/Themes/Dark.xaml +++ b/src/modules/imageresizer/ui/Themes/Dark.xaml @@ -1,11 +1,6 @@  + xmlns:system="clr-namespace:System;assembly=System.Runtime"> Dark.Accent1 diff --git a/src/modules/imageresizer/ui/Themes/HighContrast1.xaml b/src/modules/imageresizer/ui/Themes/HighContrast1.xaml index 123c3aa845..7bfaf2e19d 100644 --- a/src/modules/imageresizer/ui/Themes/HighContrast1.xaml +++ b/src/modules/imageresizer/ui/Themes/HighContrast1.xaml @@ -1,11 +1,6 @@  + xmlns:system="clr-namespace:System;assembly=System.Runtime"> HighContrast.Accent2 diff --git a/src/modules/imageresizer/ui/Themes/HighContrast2.xaml b/src/modules/imageresizer/ui/Themes/HighContrast2.xaml index 10b162d4d6..15f7f1b639 100644 --- a/src/modules/imageresizer/ui/Themes/HighContrast2.xaml +++ b/src/modules/imageresizer/ui/Themes/HighContrast2.xaml @@ -1,11 +1,6 @@  + xmlns:system="clr-namespace:System;assembly=System.Runtime"> HighContrast.Accent3 diff --git a/src/modules/imageresizer/ui/Themes/HighContrastBlack.xaml b/src/modules/imageresizer/ui/Themes/HighContrastBlack.xaml index 069adbae7c..3f5458dabb 100644 --- a/src/modules/imageresizer/ui/Themes/HighContrastBlack.xaml +++ b/src/modules/imageresizer/ui/Themes/HighContrastBlack.xaml @@ -1,12 +1,7 @@  - + xmlns:system="clr-namespace:System;assembly=System.Runtime"> + HighContrast.Accent4 PowerToysImageResizer diff --git a/src/modules/imageresizer/ui/Themes/HighContrastWhite.xaml b/src/modules/imageresizer/ui/Themes/HighContrastWhite.xaml index 620ea4f942..b68137fc4b 100644 --- a/src/modules/imageresizer/ui/Themes/HighContrastWhite.xaml +++ b/src/modules/imageresizer/ui/Themes/HighContrastWhite.xaml @@ -1,11 +1,6 @@  + xmlns:system="clr-namespace:System;assembly=System.Runtime"> HighContrast.Accent5 diff --git a/src/modules/imageresizer/ui/Themes/Light.xaml b/src/modules/imageresizer/ui/Themes/Light.xaml index e7d07ca709..3f9323e3a0 100644 --- a/src/modules/imageresizer/ui/Themes/Light.xaml +++ b/src/modules/imageresizer/ui/Themes/Light.xaml @@ -1,11 +1,6 @@  + xmlns:system="clr-namespace:System;assembly=System.Runtime"> Light.Accent1 diff --git a/src/modules/imageresizer/ui/Utilities/CustomLibraryThemeProvider.cs b/src/modules/imageresizer/ui/Utilities/CustomLibraryThemeProvider.cs new file mode 100644 index 0000000000..ab2fc3a7f5 --- /dev/null +++ b/src/modules/imageresizer/ui/Utilities/CustomLibraryThemeProvider.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using ControlzEx.Theming; + +namespace ImageResizer.Utilities +{ + public class CustomLibraryThemeProvider : LibraryThemeProvider + { + public static readonly CustomLibraryThemeProvider DefaultInstance = new CustomLibraryThemeProvider(); + + public CustomLibraryThemeProvider() + : base(true) + { + } + + /// + public override void FillColorSchemeValues(Dictionary values, RuntimeThemeColorValues colorValues) + { + } + } +} diff --git a/src/modules/imageresizer/ui/Utilities/ThemeManager.cs b/src/modules/imageresizer/ui/Utilities/ThemeManager.cs index 15c47c936f..03efb9688a 100644 --- a/src/modules/imageresizer/ui/Utilities/ThemeManager.cs +++ b/src/modules/imageresizer/ui/Utilities/ThemeManager.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. + using System; using System.Linq; using System.Windows; using ControlzEx.Theming; -using MahApps.Metro.Theming; using Microsoft.Win32; namespace ImageResizer.Utilities @@ -39,27 +39,27 @@ namespace ImageResizer.Utilities ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme( new LibraryTheme( highContrastOneThemeUri, - MahAppsLibraryThemeProvider.DefaultInstance)); + CustomLibraryThemeProvider.DefaultInstance)); ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme( new LibraryTheme( highContrastTwoThemeUri, - MahAppsLibraryThemeProvider.DefaultInstance)); + CustomLibraryThemeProvider.DefaultInstance)); ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme( new LibraryTheme( highContrastBlackThemeUri, - MahAppsLibraryThemeProvider.DefaultInstance)); + CustomLibraryThemeProvider.DefaultInstance)); ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme( new LibraryTheme( highContrastWhiteThemeUri, - MahAppsLibraryThemeProvider.DefaultInstance)); + CustomLibraryThemeProvider.DefaultInstance)); ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme( new LibraryTheme( lightThemeUri, - MahAppsLibraryThemeProvider.DefaultInstance)); + CustomLibraryThemeProvider.DefaultInstance)); ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme( new LibraryTheme( darkThemeUri, - MahAppsLibraryThemeProvider.DefaultInstance)); + CustomLibraryThemeProvider.DefaultInstance)); ResetTheme(); ControlzEx.Theming.ThemeManager.Current.ThemeSyncMode = ThemeSyncMode.SyncWithAppMode;