Merge pull request #7628 from punker76/dev/punker76/RemoveMahAppsDependencyFromLauncher

[PowerLauncher] Remove MahApps dependency and add own LibraryThemeProvider
This commit is contained in:
Clint Rutkas 2020-10-31 08:07:01 -07:00 committed by GitHub
commit a772527a4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 236 additions and 35 deletions

View File

@ -883,7 +883,7 @@
<ComponentGroup Id="LauncherComponents">
<Component Id="launcherInstallComponent" Directory="LauncherInstallFolder" Guid="5E688DB4-C522-4268-BA54-ED1CDFFE9DB6">
<File Source="$(var.BinX64Dir)modules\Launcher\Microsoft.Launcher.dll" />
<?foreach File in concrt140_app.dll;ICSharpCode.SharpZipLib.dll;JetBrains.Annotations.dll;Mages.Core.dll;Microsoft.Search.Interop.dll;EntityFramework.SqlServer.dll;EntityFramework.dll;Mono.Cecil.dll;Mono.Cecil.Mdb.dll;Mono.Cecil.Pdb.dll;Mono.Cecil.Rocks.dll;msvcp140_1_app.dll;msvcp140_2_app.dll;msvcp140_app.dll;Newtonsoft.Json.dll;NLog.dll;NLog.Extensions.Logging.dll;PowerLauncher.deps.json;PowerLauncher.dll;PowerLauncher.exe;Microsoft.Xaml.Behaviors.dll;System.Text.Json.dll;sni.dll;System.Data.SQLite.EF6.dll;PowerLauncher.runtimeconfig.json;SQLite.Interop.dll;System.Data.OleDb.dll;System.Data.SqlClient.dll;System.Data.SQLite.dll;vcamp140_app.dll;vccorlib140_app.dll;vcomp140_app.dll;vcruntime140_1_app.dll;vcruntime140_app.dll;Wox.Core.dll;Wox.Infrastructure.dll;Wox.Plugin.dll;PowerToysInterop.dll;Telemetry.dll;PowerLauncher.Telemetry.dll;Microsoft.Extensions.Configuration.Abstractions.dll;Microsoft.Extensions.Configuration.Binder.dll;Microsoft.Extensions.Configuration.dll;Microsoft.Extensions.DependencyInjection.Abstractions.dll;Microsoft.Extensions.DependencyInjection.dll;Microsoft.Extensions.Logging.Abstractions.dll;Microsoft.Extensions.Logging.dll;Microsoft.Extensions.Options.dll;Microsoft.Extensions.Primitives.dll;ControlzEx.dll;MahApps.Metro.dll;ManagedCommon.dll?>
<?foreach File in concrt140_app.dll;ICSharpCode.SharpZipLib.dll;JetBrains.Annotations.dll;Mages.Core.dll;Microsoft.Search.Interop.dll;EntityFramework.SqlServer.dll;EntityFramework.dll;Mono.Cecil.dll;Mono.Cecil.Mdb.dll;Mono.Cecil.Pdb.dll;Mono.Cecil.Rocks.dll;msvcp140_1_app.dll;msvcp140_2_app.dll;msvcp140_app.dll;Newtonsoft.Json.dll;NLog.dll;NLog.Extensions.Logging.dll;PowerLauncher.deps.json;PowerLauncher.dll;PowerLauncher.exe;Microsoft.Xaml.Behaviors.dll;System.Text.Json.dll;sni.dll;System.Data.SQLite.EF6.dll;PowerLauncher.runtimeconfig.json;SQLite.Interop.dll;System.Data.OleDb.dll;System.Data.SqlClient.dll;System.Data.SQLite.dll;vcamp140_app.dll;vccorlib140_app.dll;vcomp140_app.dll;vcruntime140_1_app.dll;vcruntime140_app.dll;Wox.Core.dll;Wox.Infrastructure.dll;Wox.Plugin.dll;PowerToysInterop.dll;Telemetry.dll;PowerLauncher.Telemetry.dll;Microsoft.Extensions.Configuration.Abstractions.dll;Microsoft.Extensions.Configuration.Binder.dll;Microsoft.Extensions.Configuration.dll;Microsoft.Extensions.DependencyInjection.Abstractions.dll;Microsoft.Extensions.DependencyInjection.dll;Microsoft.Extensions.Logging.Abstractions.dll;Microsoft.Extensions.Logging.dll;Microsoft.Extensions.Options.dll;Microsoft.Extensions.Primitives.dll;ControlzEx.dll;ManagedCommon.dll?>
<File Id="File_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\$(var.File)" />
<?endforeach?>
<File Source="$(var.BinX64Dir)SettingsUIRunner\Microsoft.PowerToys.Settings.UI.Lib.dll" />

View File

@ -1,10 +1,13 @@
<Application x:Class="PowerLauncher.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:theming="clr-namespace:Wox.Plugin;assembly=Wox.Plugin"
ShutdownMode="OnMainWindowClose"
Startup="OnStartup">
<Application.Resources>
<ResourceDictionary>
<theming:CustomLibraryThemeProvider x:Key="{x:Static theming:CustomLibraryThemeProvider.DefaultInstance}" />
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Themes/Dark.xaml" />
</ResourceDictionary.MergedDictionaries>

View File

@ -1,7 +1,5 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:markup="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
xmlns:markupWithAssembly="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
@ -14,6 +12,7 @@
<system:String x:Key="Theme.BaseColorScheme">Dark</system:String>
<system:String x:Key="Theme.ColorScheme">Accent1</system:String>
<Color x:Key="Theme.PrimaryAccentColor">Black</Color>
<system:Boolean x:Key="Theme.IsHighContrast">False</system:Boolean>
<Color x:Key="SystemBaseMediumLowColor">#FF818181</Color>
<SolidColorBrush x:Key="SystemChromeLow" Color="#FF171717" options:Freeze="True" />
@ -37,7 +36,7 @@
<Color x:Key="ScrollBarBackgroundPointerOver">#FF1b1b1b</Color>
<SolidColorBrush x:Key="ScrollBarLineButtonForeground">#FFcdcdcd</SolidColorBrush>
<SolidColorBrush x:Key="ScrollBarLineButtonForeground" Color="#FFcdcdcd" />
<Color x:Key="ScrollBarLineButtonForegroundPointerOver">#FFcdcdcd</Color>
<Color x:Key="ScrollBarLineButtonForegroundPointerPressed">#FF171717</Color>

View File

@ -1,7 +1,5 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:markup="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
xmlns:markupWithAssembly="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
@ -14,6 +12,7 @@
<system:String x:Key="Theme.BaseColorScheme">HighContrast</system:String>
<system:String x:Key="Theme.ColorScheme">Accent2</system:String>
<Color x:Key="Theme.PrimaryAccentColor">White</Color>
<system:Boolean x:Key="Theme.IsHighContrast">True</system:Boolean>
<Color x:Key="SystemBaseMediumLowColor">#ffff00</Color>
<SolidColorBrush x:Key="SystemChromeLow" Color="Black" options:Freeze="True" />
@ -37,7 +36,7 @@
<Color x:Key="ScrollBarBackgroundPointerOver">#FF000000</Color>
<SolidColorBrush x:Key="ScrollBarLineButtonForeground">#FFFFFFFF</SolidColorBrush>
<SolidColorBrush x:Key="ScrollBarLineButtonForeground" Color="#FFFFFFFF" />
<Color x:Key="ScrollBarLineButtonForegroundPointerOver">#FFFFFFFF</Color>
<Color x:Key="ScrollBarLineButtonForegroundPointerPressed">#FFFFFFFF</Color>

View File

@ -1,7 +1,5 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:markup="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
xmlns:markupWithAssembly="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
@ -14,6 +12,7 @@
<system:String x:Key="Theme.BaseColorScheme">HighContrast</system:String>
<system:String x:Key="Theme.ColorScheme">Accent3</system:String>
<Color x:Key="Theme.PrimaryAccentColor">White</Color>
<system:Boolean x:Key="Theme.IsHighContrast">True</system:Boolean>
<Color x:Key="SystemBaseMediumLowColor">#ffff00</Color>
<SolidColorBrush x:Key="SystemChromeLow" Color="Black" options:Freeze="True" />
@ -37,7 +36,7 @@
<Color x:Key="ScrollBarBackgroundPointerOver">#FF000000</Color>
<SolidColorBrush x:Key="ScrollBarLineButtonForeground">#FFFFFFFF</SolidColorBrush>
<SolidColorBrush x:Key="ScrollBarLineButtonForeground" Color="#FFFFFFFF" />
<Color x:Key="ScrollBarLineButtonForegroundPointerOver">#FFFFFFFF</Color>
<Color x:Key="ScrollBarLineButtonForegroundPointerPressed">#FFFFFFFF</Color>

View File

@ -1,7 +1,5 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:markup="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
xmlns:markupWithAssembly="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
@ -14,6 +12,7 @@
<system:String x:Key="Theme.BaseColorScheme">HighContrast</system:String>
<system:String x:Key="Theme.ColorScheme">Accent4</system:String>
<Color x:Key="Theme.PrimaryAccentColor">White</Color>
<system:Boolean x:Key="Theme.IsHighContrast">True</system:Boolean>
<Color x:Key="SystemBaseMediumLowColor">#66FFFFFF</Color>
<SolidColorBrush x:Key="SystemChromeLow" Color="Black" options:Freeze="True" />
@ -37,7 +36,7 @@
<Color x:Key="ScrollBarBackgroundPointerOver">#FF000000</Color>
<SolidColorBrush x:Key="ScrollBarLineButtonForeground">#FFFFFFFF</SolidColorBrush>
<SolidColorBrush x:Key="ScrollBarLineButtonForeground" Color="#FFFFFFFF" />
<Color x:Key="ScrollBarLineButtonForegroundPointerOver">#FFFFFFFF</Color>
<Color x:Key="ScrollBarLineButtonForegroundPointerPressed">#FFFFFFFF</Color>

View File

@ -1,7 +1,5 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:markup="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
xmlns:markupWithAssembly="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
@ -14,6 +12,7 @@
<system:String x:Key="Theme.BaseColorScheme">HighContrast</system:String>
<system:String x:Key="Theme.ColorScheme">Accent5</system:String>
<Color x:Key="Theme.PrimaryAccentColor">White</Color>
<system:Boolean x:Key="Theme.IsHighContrast">True</system:Boolean>
<Color x:Key="SystemBaseMediumLowColor">#66000000</Color>
<SolidColorBrush x:Key="SystemChromeLow" Color="White" options:Freeze="True" />
@ -37,7 +36,7 @@
<Color x:Key="ScrollBarBackgroundPointerOver">#FFf0f0f0</Color>
<SolidColorBrush x:Key="ScrollBarLineButtonForeground">#FF000000</SolidColorBrush>
<SolidColorBrush x:Key="ScrollBarLineButtonForeground" Color="#FF000000" />
<Color x:Key="ScrollBarLineButtonForegroundPointerOver">#FF000000</Color>
<Color x:Key="ScrollBarLineButtonForegroundPointerPressed">#FF000000</Color>

View File

@ -1,7 +1,5 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:markup="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
xmlns:markupWithAssembly="clr-namespace:MahApps.Metro.Markup;assembly=MahApps.Metro"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
@ -14,6 +12,7 @@
<system:String x:Key="Theme.BaseColorScheme">Light</system:String>
<system:String x:Key="Theme.ColorScheme">Accent1</system:String>
<Color x:Key="Theme.PrimaryAccentColor">White</Color>
<system:Boolean x:Key="Theme.IsHighContrast">False</system:Boolean>
<Color x:Key="SystemBaseMediumLowColor">#66000000</Color>
<SolidColorBrush x:Key="SystemChromeLow" Color="#FFF2F2F2" options:Freeze="True" />
@ -37,7 +36,7 @@
<Color x:Key="ScrollBarBackgroundPointerOver">#FFf0f0f0</Color>
<SolidColorBrush x:Key="ScrollBarLineButtonForeground">#FF1d1d1d</SolidColorBrush>
<SolidColorBrush x:Key="ScrollBarLineButtonForeground" Color="#FF1d1d1d" />
<Color x:Key="ScrollBarLineButtonForegroundPointerOver">#FF1d1d1d</Color>
<Color x:Key="ScrollBarLineButtonForegroundPointerPressed">#FFf3f3f3</Color>

View File

@ -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 Wox.Plugin
{
public class CustomLibraryThemeProvider : LibraryThemeProvider
{
public static readonly CustomLibraryThemeProvider DefaultInstance = new CustomLibraryThemeProvider();
public CustomLibraryThemeProvider()
: base(true)
{
}
/// <inheritdoc />
public override void FillColorSchemeValues(Dictionary<string, string> values, RuntimeThemeColorValues colorValues)
{
}
}
}

View File

@ -0,0 +1,111 @@
{
"DefaultValues": {
"Theme.IsHighContrast": "false"
},
"BaseColorSchemes": [
{
"Name": "Dark",
"Values": {
"PrimaryAccentColor": "Black",
"SystemBaseMediumLowColor": "#FF818181",
"SystemChromeLow": "#FF171717",
"TextControlPlaceholderForeground": "#FF818181",
"TextBox.Static.Border": "Transparent",
"TextBox.MouseOver.Border": "Transparent",
"TextBox.Focus.Border": "Transparent",
"ButtonBackgroundPointerOver": "#30FFFFFF",
"ButtonBorderPointerOver": "#61FFFFFF",
"ButtonBackgroundPressed": "#30FFFFFF",
"ButtonBorderPressed": "#61FFFFFF",
"ListViewItemBackgroundPointerOver": "#FF363636",
"ControlTextBrushKey": "White",
"SecondaryTextForeground": "#FFa1a1a1",
"InactiveSelectionHighlightBrushKey": "White",
"DialogBorderBrush": "#FF373737",
"ScrollBarThumbBackground": "#FF7a7a7a",
"ScrollBarThumbPointerOver": "#FF767676",
"ScrollBarThumbPointerPressed": "#FFa4a4a4",
"ScrollBarBackgroundPointerOver": "#FF1b1b1b",
"ScrollBarLineButtonForeground": "#FFcdcdcd",
"ScrollBarLineButtonForegroundPointerOver": "#FFcdcdcd",
"ScrollBarLineButtonForegroundPointerPressed": "#FF171717",
"ScrollBarLineButtonBackground": "Transparent",
"ScrollBarLineButtonBackgroundPointerOver": "#FF313131",
"ScrollBarLineButtonBackgroundPointerPressed": "#FFa4a4a4",
"ToolTipBorderBrushKey": "#5B000000",
"ToolTipForegroundBrushKey": "#FFFFFFFF",
"ToolTipBackgroundBrushKey": "#FF2B2B2B"
}
},
{
"Name": "Light",
"Values": {
"PrimaryAccentColor": "White",
"SystemBaseMediumLowColor": "#66000000",
"SystemChromeLow": "#FFF2F2F2",
"TextControlPlaceholderForeground": "#FF5b5b5b",
"TextBox.Static.Border": "Transparent",
"TextBox.MouseOver.Border": "Transparent",
"TextBox.Focus.Border": "Transparent",
"ButtonBackgroundPointerOver": "#2E000000",
"ButtonBorderPointerOver": "#61000000",
"ButtonBackgroundPressed": "#30000000",
"ButtonBorderPressed": "#61000000",
"ListViewItemBackgroundPointerOver": "#FFd2d2d2",
"ControlTextBrushKey": "Black",
"SecondaryTextForeground": "#FF434343",
"InactiveSelectionHighlightBrushKey": "Black",
"DialogBorderBrush": "#FFf7f7f7",
"ScrollBarThumbBackground": "#FF7a7a7a",
"ScrollBarThumbPointerOver": "#FFa0a0a0",
"ScrollBarThumbPointerPressed": "#FF747474",
"ScrollBarBackgroundPointerOver": "#FFf0f0f0",
"ScrollBarLineButtonForeground": "#FF1d1d1d",
"ScrollBarLineButtonForegroundPointerOver": "#FF1d1d1d",
"ScrollBarLineButtonForegroundPointerPressed": "#FFf3f3f3",
"ScrollBarLineButtonBackground": "Transparent",
"ScrollBarLineButtonBackgroundPointerOver": "#FFd2d2d2",
"ScrollBarLineButtonBackgroundPointerPressed": "#FF5d5d5d",
"ToolTipBorderBrushKey": "#FFD0D0D0",
"ToolTipForegroundBrushKey": "#FF000000",
"ToolTipBackgroundBrushKey": "#FFFBFBFB"
}
},
{
"Name": "HighContrast",
"Values": {
"Theme.IsHighContrast": "true",
"PrimaryAccentColor": "White",
"SystemBaseMediumLowColor": "#ffff00",
"SystemChromeLow": "Black",
"TextControlPlaceholderForeground": "#FF008000",
"TextBox.Static.Border": "Transparent",
"TextBox.MouseOver.Border": "Transparent",
"TextBox.Focus.Border": "Transparent",
"ButtonBackgroundPointerOver": "Black",
"ButtonBorderPointerOver": "White",
"ButtonBackgroundPressed": "White",
"ButtonBorderPressed": "White",
"ListViewItemBackgroundPointerOver": "#FF003300",
"ControlTextBrushKey": "#FFffff00",
"SecondaryTextForeground": "#FF008000",
"InactiveSelectionHighlightBrushKey": "#FFFFFFFF",
"DialogBorderBrush": "#FF373737",
"ScrollBarThumbBackground": "White",
"ScrollBarThumbPointerOver": "#FF008000",
"ScrollBarThumbPointerPressed": "#FF008000",
"ScrollBarBackgroundPointerOver": "#FF000000",
"ScrollBarLineButtonForeground": "#FFFFFFFF",
"ScrollBarLineButtonForegroundPointerOver": "#FFFFFFFF",
"ScrollBarLineButtonForegroundPointerPressed": "#FFFFFFFF",
"ScrollBarLineButtonBackground": "Black",
"ScrollBarLineButtonBackgroundPointerOver": "#FF000000",
"ScrollBarLineButtonBackgroundPointerPressed": "#FF000000",
"ToolTipBorderBrushKey": "#5B000000",
"ToolTipForegroundBrushKey": "#FFFFFFFF",
"ToolTipBackgroundBrushKey": "#FF2B2B2B"
}
}
],
"ColorSchemes": []
}

View File

@ -0,0 +1,50 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
mc:Ignorable="options">
<!-- Metadata -->
<system:String x:Key="Theme.Name">{{ThemeName}}</system:String>
<system:String x:Key="Theme.Origin">PowerToysRun</system:String>
<system:String x:Key="Theme.DisplayName">{{ThemeDisplayName}}</system:String>
<system:String x:Key="Theme.BaseColorScheme">{{BaseColorScheme}}</system:String>
<system:String x:Key="Theme.ColorScheme">{{ColorScheme}}</system:String>
<Color x:Key="Theme.PrimaryAccentColor">{{PrimaryAccentColor}}</Color>
<system:Boolean x:Key="Theme.IsHighContrast">{{IsHighContrast}}</system:Boolean>
<Color x:Key="SystemBaseMediumLowColor">{{SystemBaseMediumLowColor}}</Color>
<SolidColorBrush x:Key="SystemChromeLow" Color="{{SystemChromeLow}}" options:Freeze="True" />
<SolidColorBrush x:Key="TextControlPlaceholderForeground" Color="{{TextControlPlaceholderForeground}}" />
<SolidColorBrush x:Key="TextBox.Static.Border" Color="{{TextBox.Static.Border}}"/>
<SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="{{TextBox.MouseOver.Border}}"/>
<SolidColorBrush x:Key="TextBox.Focus.Border" Color="{{TextBox.Focus.Border}}"/>
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="{{ButtonBackgroundPointerOver}}" />
<SolidColorBrush x:Key="ButtonBorderPointerOver" Color="{{ButtonBorderPointerOver}}" />
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="{{ButtonBackgroundPressed}}" />
<SolidColorBrush x:Key="ButtonBorderPressed" Color="{{ButtonBorderPressed}}" />
<SolidColorBrush x:Key="ListViewItemBackgroundPointerOver" Color="{{ListViewItemBackgroundPointerOver}}" />
<SolidColorBrush x:Key="ControlTextBrushKey" Color="{{ControlTextBrushKey}}" />
<SolidColorBrush x:Key="SecondaryTextForeground" Color="{{SecondaryTextForeground}}" />
<SolidColorBrush x:Key="InactiveSelectionHighlightBrushKey" Color="{{InactiveSelectionHighlightBrushKey}}" />
<SolidColorBrush x:Key="DialogBorderBrush" Color="{{DialogBorderBrush}}" />
<SolidColorBrush x:Key="ScrollBarThumbBackground" Color="{{ScrollBarThumbBackground}}" />
<Color x:Key="ScrollBarThumbPointerOver">{{ScrollBarThumbPointerOver}}</Color>
<Color x:Key="ScrollBarThumbPointerPressed">{{ScrollBarThumbPointerPressed}}</Color>
<Color x:Key="ScrollBarBackgroundPointerOver">{{ScrollBarBackgroundPointerOver}}</Color>
<SolidColorBrush x:Key="ScrollBarLineButtonForeground" Color="{{ScrollBarLineButtonForeground}}" />
<Color x:Key="ScrollBarLineButtonForegroundPointerOver">{{ScrollBarLineButtonForegroundPointerOver}}</Color>
<Color x:Key="ScrollBarLineButtonForegroundPointerPressed">{{ScrollBarLineButtonForegroundPointerPressed}}</Color>
<SolidColorBrush x:Key="ScrollBarLineButtonBackground" Color="{{ScrollBarLineButtonBackground}}"/>
<Color x:Key="ScrollBarLineButtonBackgroundPointerOver">{{ScrollBarLineButtonBackgroundPointerOver}}</Color>
<Color x:Key="ScrollBarLineButtonBackgroundPointerPressed">{{ScrollBarLineButtonBackgroundPointerPressed}}</Color>
<SolidColorBrush x:Key="ToolTipBorderBrushKey" Color="{{ToolTipBorderBrushKey}}" />
<SolidColorBrush x:Key="ToolTipForegroundBrushKey" Color="{{ToolTipForegroundBrushKey}}" />
<SolidColorBrush x:Key="ToolTipBackgroundBrushKey" Color="{{ToolTipBackgroundBrushKey}}" />
</ResourceDictionary>

View File

@ -1,11 +1,10 @@
// Copyright (c) Microsoft Corporation
// 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 MahApps.Metro.Theming;
using ManagedCommon;
using Microsoft.Win32;
@ -40,31 +39,35 @@ namespace Wox.Plugin
ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
new ControlzEx.Theming.LibraryTheme(
highContrastOneThemeUri,
MahAppsLibraryThemeProvider.DefaultInstance));
CustomLibraryThemeProvider.DefaultInstance));
ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
new ControlzEx.Theming.LibraryTheme(
highContrastTwoThemeUri,
MahAppsLibraryThemeProvider.DefaultInstance));
CustomLibraryThemeProvider.DefaultInstance));
ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
new ControlzEx.Theming.LibraryTheme(
highContrastBlackThemeUri,
MahAppsLibraryThemeProvider.DefaultInstance));
CustomLibraryThemeProvider.DefaultInstance));
ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
new ControlzEx.Theming.LibraryTheme(
highContrastWhiteThemeUri,
MahAppsLibraryThemeProvider.DefaultInstance));
CustomLibraryThemeProvider.DefaultInstance));
ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
new ControlzEx.Theming.LibraryTheme(
lightThemeUri,
MahAppsLibraryThemeProvider.DefaultInstance));
CustomLibraryThemeProvider.DefaultInstance));
ControlzEx.Theming.ThemeManager.Current.AddLibraryTheme(
new ControlzEx.Theming.LibraryTheme(
darkThemeUri,
MahAppsLibraryThemeProvider.DefaultInstance));
CustomLibraryThemeProvider.DefaultInstance));
ResetTheme();
ControlzEx.Theming.ThemeManager.Current.ThemeSyncMode = ControlzEx.Theming.ThemeSyncMode.SyncAll;
ControlzEx.Theming.ThemeManager.Current.ThemeChanged += Current_ThemeChanged;
// Currently there is an issue in ControlzEx, so we must use SyncAll to sync also HighContrast themes.
// We can change this after using next release.
ControlzEx.Theming.ThemeManager.Current.ThemeSyncMode = ControlzEx.Theming.ThemeSyncMode.SyncAll;
ControlzEx.Theming.ThemeManager.Current.SyncTheme();
}
public Theme GetCurrentTheme()
@ -119,22 +122,22 @@ namespace Wox.Plugin
else if (theme == Theme.HighContrastOne)
{
currentTheme = Theme.HighContrastOne;
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastOneTheme);
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastOneTheme, true);
}
else if (theme == Theme.HighContrastTwo)
{
currentTheme = Theme.HighContrastTwo;
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastTwoTheme);
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastTwoTheme, true);
}
else if (theme == Theme.HighContrastWhite)
{
currentTheme = Theme.HighContrastWhite;
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastWhiteTheme);
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastWhiteTheme, true);
}
else if (theme == Theme.HighContrastBlack)
{
currentTheme = Theme.HighContrastBlack;
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastBlackTheme);
ControlzEx.Theming.ThemeManager.Current.ChangeTheme(_app, HighContrastBlackTheme, true);
}
else if (theme == Theme.Light)
{
@ -157,7 +160,15 @@ namespace Wox.Plugin
private void Current_ThemeChanged(object sender, ControlzEx.Theming.ThemeChangedEventArgs e)
{
ResetTheme();
ControlzEx.Theming.ThemeManager.Current.ThemeChanged -= Current_ThemeChanged;
try
{
ResetTheme();
}
finally
{
ControlzEx.Theming.ThemeManager.Current.ThemeChanged += Current_ThemeChanged;
}
}
protected virtual void Dispose(bool disposing)

View File

@ -49,6 +49,15 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<DefaultItemExcludes>$(DefaultItemExcludes);**/*.Template.xaml</DefaultItemExcludes>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="**/*.Template.xaml" />
<EmbeddedResource Include="**/GeneratorParameters.json" />
<UpToDateCheckInput Include="**/*.xaml" />
</ItemGroup>
<ItemGroup>
<None Include="README.md" />
</ItemGroup>
@ -67,7 +76,6 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" />
<PackageReference Include="MahApps.Metro" Version="2.3.0" />
<PackageReference Include="ControlzEx" Version="4.3.2" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
<PrivateAssets>all</PrivateAssets>