mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 09:28:03 +08:00
Refactoring blur
1. Refactoring blur, see discussion in : 7f8bb80 2. Releated issue: #330
This commit is contained in:
parent
a8c6a97579
commit
38791e50ea
@ -79,7 +79,7 @@ namespace Wox.Core.Plugin
|
|||||||
Concat(new JsonRPCPluginLoader<PythonPlugin>().LoadPlugin(metadatas));
|
Concat(new JsonRPCPluginLoader<PythonPlugin>().LoadPlugin(metadatas));
|
||||||
|
|
||||||
//load plugin i18n languages
|
//load plugin i18n languages
|
||||||
ResourceMerger.ApplyPluginLanguages();
|
ResourceMerger.UpdatePluginLanguages();
|
||||||
|
|
||||||
foreach (PluginPair pluginPair in AllPlugins)
|
foreach (PluginPair pluginPair in AllPlugins)
|
||||||
{
|
{
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Wox.Core.Theme
|
|
||||||
{
|
|
||||||
interface ITheme
|
|
||||||
{
|
|
||||||
void ChangeTheme(string themeName);
|
|
||||||
List<string> LoadAvailableThemes();
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,8 +3,10 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Wox.Core.UI;
|
using Wox.Core.UI;
|
||||||
using Wox.Core.UserSettings;
|
using Wox.Core.UserSettings;
|
||||||
@ -12,7 +14,7 @@ using Wox.Infrastructure.Logger;
|
|||||||
|
|
||||||
namespace Wox.Core.Theme
|
namespace Wox.Core.Theme
|
||||||
{
|
{
|
||||||
public class Theme : IUIResource,ITheme
|
public class Theme : IUIResource
|
||||||
{
|
{
|
||||||
public const string DirectoryName = "Themes";
|
public const string DirectoryName = "Themes";
|
||||||
private static List<string> themeDirectories = new List<string>();
|
private static List<string> themeDirectories = new List<string>();
|
||||||
@ -53,11 +55,21 @@ namespace Wox.Core.Theme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceMerger.ApplyThemeResource(this);
|
|
||||||
|
|
||||||
UserSettingStorage.Instance.Theme = themeName;
|
UserSettingStorage.Instance.Theme = themeName;
|
||||||
UserSettingStorage.Instance.ThemeBlurEnabled = (bool)Application.Current.Resources["ThemeBlurEnabled"];
|
|
||||||
UserSettingStorage.Instance.Save();
|
UserSettingStorage.Instance.Save();
|
||||||
|
ResourceMerger.UpdateResource(this);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var isBlur = Application.Current.FindResource("ThemeBlurEnabled");
|
||||||
|
if (isBlur is bool)
|
||||||
|
{
|
||||||
|
SetBlurForWindow(Application.Current.MainWindow, (bool)isBlur);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ResourceReferenceKeyNotFoundException e)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResourceDictionary GetResourceDictionary()
|
public ResourceDictionary GetResourceDictionary()
|
||||||
@ -119,5 +131,74 @@ namespace Wox.Core.Theme
|
|||||||
|
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Blur Handling
|
||||||
|
/*
|
||||||
|
Found on https://github.com/riverar/sample-win10-aeroglass
|
||||||
|
*/
|
||||||
|
public enum AccentState
|
||||||
|
{
|
||||||
|
ACCENT_DISABLED = 0,
|
||||||
|
ACCENT_ENABLE_GRADIENT = 1,
|
||||||
|
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
|
||||||
|
ACCENT_ENABLE_BLURBEHIND = 3,
|
||||||
|
ACCENT_INVALID_STATE = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct AccentPolicy
|
||||||
|
{
|
||||||
|
public AccentState AccentState;
|
||||||
|
public int AccentFlags;
|
||||||
|
public int GradientColor;
|
||||||
|
public int AnimationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct WindowCompositionAttributeData
|
||||||
|
{
|
||||||
|
public WindowCompositionAttribute Attribute;
|
||||||
|
public IntPtr Data;
|
||||||
|
public int SizeOfData;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal enum WindowCompositionAttribute
|
||||||
|
{
|
||||||
|
WCA_ACCENT_POLICY = 19
|
||||||
|
}
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the blur for a window via SetWindowCompositionAttribute
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="wind">window to blur</param>
|
||||||
|
/// <param name="status">true/false - on or off correspondingly</param>
|
||||||
|
public void SetBlurForWindow(Window wind, bool status)
|
||||||
|
{
|
||||||
|
SetWindowAccent(wind, status ? AccentState.ACCENT_ENABLE_BLURBEHIND : AccentState.ACCENT_DISABLED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetWindowAccent(Window wind, AccentState themeAccentMode)
|
||||||
|
{
|
||||||
|
var windowHelper = new WindowInteropHelper(wind);
|
||||||
|
var accent = new AccentPolicy { AccentState = themeAccentMode };
|
||||||
|
var accentStructSize = Marshal.SizeOf(accent);
|
||||||
|
|
||||||
|
var accentPtr = Marshal.AllocHGlobal(accentStructSize);
|
||||||
|
Marshal.StructureToPtr(accent, accentPtr, false);
|
||||||
|
|
||||||
|
var data = new WindowCompositionAttributeData
|
||||||
|
{
|
||||||
|
Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY,
|
||||||
|
SizeOfData = accentStructSize,
|
||||||
|
Data = accentPtr
|
||||||
|
};
|
||||||
|
|
||||||
|
SetWindowCompositionAttribute(windowHelper.Handle, ref data);
|
||||||
|
|
||||||
|
Marshal.FreeHGlobal(accentPtr);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Wox.Core.i18n;
|
using Wox.Core.i18n;
|
||||||
@ -9,34 +10,34 @@ namespace Wox.Core.UI
|
|||||||
{
|
{
|
||||||
public static class ResourceMerger
|
public static class ResourceMerger
|
||||||
{
|
{
|
||||||
private static void RemoveResource(string resourceDirectoryName)
|
private static void RemoveResource(string directoryName)
|
||||||
{
|
{
|
||||||
var mergedDictionaries = Application.Current.Resources.MergedDictionaries;
|
directoryName = $"{Path.DirectorySeparatorChar}{directoryName}";
|
||||||
foreach (var resource in mergedDictionaries)
|
var dictionaries = Application.Current.Resources.MergedDictionaries;
|
||||||
|
foreach (var resource in dictionaries)
|
||||||
{
|
{
|
||||||
int directoryPosition = resource.Source.Segments.Length - 2;
|
string currentDirectoryName = Path.GetDirectoryName(resource.Source.AbsolutePath);
|
||||||
string currentDirectoryName = resource.Source.Segments[directoryPosition];
|
if (currentDirectoryName == directoryName)
|
||||||
if (currentDirectoryName == resourceDirectoryName)
|
|
||||||
{
|
{
|
||||||
mergedDictionaries.Remove(resource);
|
dictionaries.Remove(resource);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ApplyThemeResource(Theme.Theme t)
|
public static void UpdateResource(Theme.Theme t)
|
||||||
{
|
{
|
||||||
RemoveResource(Theme.Theme.DirectoryName);
|
RemoveResource(Theme.Theme.DirectoryName);
|
||||||
Application.Current.Resources.MergedDictionaries.Add(t.GetResourceDictionary());
|
Application.Current.Resources.MergedDictionaries.Add(t.GetResourceDictionary());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ApplyLanguageResources(Internationalization i)
|
public static void UpdateResources(Internationalization i)
|
||||||
{
|
{
|
||||||
RemoveResource(Internationalization.DirectoryName);
|
RemoveResource(Internationalization.DirectoryName);
|
||||||
Application.Current.Resources.MergedDictionaries.Add(i.GetResourceDictionary());
|
Application.Current.Resources.MergedDictionaries.Add(i.GetResourceDictionary());
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void ApplyPluginLanguages()
|
internal static void UpdatePluginLanguages()
|
||||||
{
|
{
|
||||||
RemoveResource(PluginManager.DirectoryName);
|
RemoveResource(PluginManager.DirectoryName);
|
||||||
foreach (var languageFile in PluginManager.GetPluginsForInterface<IPluginI18n>().
|
foreach (var languageFile in PluginManager.GetPluginsForInterface<IPluginI18n>().
|
||||||
|
@ -55,9 +55,6 @@ namespace Wox.Core.UserSettings
|
|||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public string ResultItemFontStretch { get; set; }
|
public string ResultItemFontStretch { get; set; }
|
||||||
|
|
||||||
[JsonProperty]
|
|
||||||
public bool ThemeBlurEnabled { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public double WindowLeft { get; set; }
|
public double WindowLeft { get; set; }
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@
|
|||||||
<Compile Include="i18n\Internationalization.cs" />
|
<Compile Include="i18n\Internationalization.cs" />
|
||||||
<Compile Include="i18n\InternationalizationManager.cs" />
|
<Compile Include="i18n\InternationalizationManager.cs" />
|
||||||
<Compile Include="i18n\Language.cs" />
|
<Compile Include="i18n\Language.cs" />
|
||||||
<Compile Include="Theme\ITheme.cs" />
|
|
||||||
<Compile Include="Theme\ThemeManager.cs" />
|
<Compile Include="Theme\ThemeManager.cs" />
|
||||||
<Compile Include="UI\IUIResource.cs" />
|
<Compile Include="UI\IUIResource.cs" />
|
||||||
<Compile Include="UI\ResourceMerger.cs" />
|
<Compile Include="UI\ResourceMerger.cs" />
|
||||||
|
@ -70,7 +70,7 @@ namespace Wox.Core.i18n
|
|||||||
|
|
||||||
UserSettingStorage.Instance.Language = language.LanguageCode;
|
UserSettingStorage.Instance.Language = language.LanguageCode;
|
||||||
UserSettingStorage.Instance.Save();
|
UserSettingStorage.Instance.Save();
|
||||||
ResourceMerger.ApplyLanguageResources(this);
|
ResourceMerger.UpdateResources(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResourceDictionary GetResourceDictionary()
|
public ResourceDictionary GetResourceDictionary()
|
||||||
|
@ -88,75 +88,5 @@ namespace Wox.Helper
|
|||||||
public int Right;
|
public int Right;
|
||||||
public int Bottom;
|
public int Bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Blur Handling
|
|
||||||
/*
|
|
||||||
Found on https://github.com/riverar/sample-win10-aeroglass
|
|
||||||
*/
|
|
||||||
public enum AccentState
|
|
||||||
{
|
|
||||||
ACCENT_DISABLED = 0,
|
|
||||||
ACCENT_ENABLE_GRADIENT = 1,
|
|
||||||
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
|
|
||||||
ACCENT_ENABLE_BLURBEHIND = 3,
|
|
||||||
ACCENT_INVALID_STATE = 4
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal struct AccentPolicy
|
|
||||||
{
|
|
||||||
public AccentState AccentState;
|
|
||||||
public int AccentFlags;
|
|
||||||
public int GradientColor;
|
|
||||||
public int AnimationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
internal struct WindowCompositionAttributeData
|
|
||||||
{
|
|
||||||
public WindowCompositionAttribute Attribute;
|
|
||||||
public IntPtr Data;
|
|
||||||
public int SizeOfData;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal enum WindowCompositionAttribute
|
|
||||||
{
|
|
||||||
WCA_ACCENT_POLICY = 19
|
|
||||||
}
|
|
||||||
[DllImport("user32.dll")]
|
|
||||||
private static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the blur for a window via SetWindowCompositionAttribute
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="wind">window to blur</param>
|
|
||||||
/// <param name="status">true/false - on or off correspondingly</param>
|
|
||||||
public static void SetBlurForWindow(Window wind, bool status)
|
|
||||||
{
|
|
||||||
SetWindowAccent(wind, status ? AccentState.ACCENT_ENABLE_BLURBEHIND : AccentState.ACCENT_DISABLED);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void SetWindowAccent(Window wind, AccentState themeAccentMode)
|
|
||||||
{
|
|
||||||
var windowHelper = new WindowInteropHelper(wind);
|
|
||||||
var accent = new AccentPolicy();
|
|
||||||
accent.AccentState = themeAccentMode;
|
|
||||||
var accentStructSize = Marshal.SizeOf(accent);
|
|
||||||
|
|
||||||
var accentPtr = Marshal.AllocHGlobal(accentStructSize);
|
|
||||||
Marshal.StructureToPtr(accent, accentPtr, false);
|
|
||||||
|
|
||||||
var data = new WindowCompositionAttributeData();
|
|
||||||
data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY;
|
|
||||||
data.SizeOfData = accentStructSize;
|
|
||||||
data.Data = accentPtr;
|
|
||||||
|
|
||||||
SetWindowCompositionAttribute(windowHelper.Handle, ref data);
|
|
||||||
|
|
||||||
Marshal.FreeHGlobal(accentPtr);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -43,7 +43,6 @@
|
|||||||
<system:String x:Key="resultItemFont">Result Item Font</system:String>
|
<system:String x:Key="resultItemFont">Result Item Font</system:String>
|
||||||
<system:String x:Key="windowMode">Window Mode</system:String>
|
<system:String x:Key="windowMode">Window Mode</system:String>
|
||||||
<system:String x:Key="opacity">Opacity</system:String>
|
<system:String x:Key="opacity">Opacity</system:String>
|
||||||
<system:String x:Key="windowsAccents">Windows Accents</system:String>
|
|
||||||
|
|
||||||
|
|
||||||
<!--Setting Hotkey-->
|
<!--Setting Hotkey-->
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
<system:String x:Key="resultItemFont">Шрифт результатов</system:String>
|
<system:String x:Key="resultItemFont">Шрифт результатов</system:String>
|
||||||
<system:String x:Key="windowMode">Оконный режим</system:String>
|
<system:String x:Key="windowMode">Оконный режим</system:String>
|
||||||
<system:String x:Key="opacity">Прозрачность</system:String>
|
<system:String x:Key="opacity">Прозрачность</system:String>
|
||||||
<system:String x:Key="windowsAccents">Windows Accents</system:String>
|
|
||||||
|
|
||||||
<!--Setting Hotkey-->
|
<!--Setting Hotkey-->
|
||||||
<system:String x:Key="hotkey">Горячие клавиши</system:String>
|
<system:String x:Key="hotkey">Горячие клавиши</system:String>
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
<system:String x:Key="resultItemFont">结果项字体</system:String>
|
<system:String x:Key="resultItemFont">结果项字体</system:String>
|
||||||
<system:String x:Key="windowMode">窗口模式</system:String>
|
<system:String x:Key="windowMode">窗口模式</system:String>
|
||||||
<system:String x:Key="opacity">透明度</system:String>
|
<system:String x:Key="opacity">透明度</system:String>
|
||||||
<system:String x:Key="windowsAccents">Windows Accents</system:String>
|
|
||||||
|
|
||||||
<!--设置,热键-->
|
<!--设置,热键-->
|
||||||
<system:String x:Key="hotkey">热键</system:String>
|
<system:String x:Key="hotkey">热键</system:String>
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
<system:String x:Key="resultItemFont">結果項字體</system:String>
|
<system:String x:Key="resultItemFont">結果項字體</system:String>
|
||||||
<system:String x:Key="windowMode">窗口模式</system:String>
|
<system:String x:Key="windowMode">窗口模式</system:String>
|
||||||
<system:String x:Key="opacity">透明度</system:String>
|
<system:String x:Key="opacity">透明度</system:String>
|
||||||
<system:String x:Key="windowsAccents">Windows Accents</system:String>
|
|
||||||
|
|
||||||
<!--設置,熱鍵-->
|
<!--設置,熱鍵-->
|
||||||
<system:String x:Key="hotkey">熱鍵</system:String>
|
<system:String x:Key="hotkey">熱鍵</system:String>
|
||||||
|
@ -198,16 +198,12 @@ namespace Wox
|
|||||||
pnlResult.ItemDropEvent += pnlResult_ItemDropEvent;
|
pnlResult.ItemDropEvent += pnlResult_ItemDropEvent;
|
||||||
pnlContextMenu.LeftMouseClickEvent += SelectResult;
|
pnlContextMenu.LeftMouseClickEvent += SelectResult;
|
||||||
pnlResult.RightMouseClickEvent += pnlResult_RightMouseClickEvent;
|
pnlResult.RightMouseClickEvent += pnlResult_RightMouseClickEvent;
|
||||||
|
Closing += MainWindow_Closing;
|
||||||
|
|
||||||
ThemeManager.Theme.ChangeTheme(UserSettingStorage.Instance.Theme);
|
|
||||||
InternationalizationManager.Instance.ChangeLanguage(UserSettingStorage.Instance.Language);
|
|
||||||
|
|
||||||
SetHotkey(UserSettingStorage.Instance.Hotkey, OnHotkey);
|
SetHotkey(UserSettingStorage.Instance.Hotkey, OnHotkey);
|
||||||
SetCustomPluginHotkey();
|
SetCustomPluginHotkey();
|
||||||
InitialTray();
|
InitialTray();
|
||||||
|
|
||||||
Closing += MainWindow_Closing;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pnlResult_ItemDropEvent(Result result, IDataObject dropDataObject, DragEventArgs args)
|
void pnlResult_ItemDropEvent(Result result, IDataObject dropDataObject, DragEventArgs args)
|
||||||
@ -250,12 +246,14 @@ namespace Wox
|
|||||||
|
|
||||||
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
|
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
ThemeManager.Theme.ChangeTheme(UserSettingStorage.Instance.Theme);
|
||||||
|
InternationalizationManager.Instance.ChangeLanguage(UserSettingStorage.Instance.Language);
|
||||||
|
|
||||||
Left = GetWindowsLeft();
|
Left = GetWindowsLeft();
|
||||||
Top = GetWindowsTop();
|
Top = GetWindowsTop();
|
||||||
|
|
||||||
InitProgressbarAnimation();
|
InitProgressbarAnimation();
|
||||||
WindowIntelopHelper.DisableControlBox(this);
|
WindowIntelopHelper.DisableControlBox(this);
|
||||||
WindowIntelopHelper.SetBlurForWindow(this, UserSettingStorage.Instance.ThemeBlurEnabled);
|
|
||||||
CheckUpdate();
|
CheckUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,9 +440,7 @@ namespace Wox
|
|||||||
private void ThemeComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void ThemeComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
string themeName = themeComboBox.SelectedItem.ToString();
|
string themeName = themeComboBox.SelectedItem.ToString();
|
||||||
UserSettingStorage.Instance.Theme = themeName;
|
ThemeManager.Theme.ChangeTheme(themeName);
|
||||||
DelayChangeTheme();
|
|
||||||
UserSettingStorage.Instance.Save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CbQueryBoxFont_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void CbQueryBoxFont_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
@ -451,19 +449,9 @@ namespace Wox
|
|||||||
string queryBoxFontName = cbQueryBoxFont.SelectedItem.ToString();
|
string queryBoxFontName = cbQueryBoxFont.SelectedItem.ToString();
|
||||||
UserSettingStorage.Instance.QueryBoxFont = queryBoxFontName;
|
UserSettingStorage.Instance.QueryBoxFont = queryBoxFontName;
|
||||||
this.cbQueryBoxFontFaces.SelectedItem = ((FontFamily)cbQueryBoxFont.SelectedItem).ChooseRegularFamilyTypeface();
|
this.cbQueryBoxFontFaces.SelectedItem = ((FontFamily)cbQueryBoxFont.SelectedItem).ChooseRegularFamilyTypeface();
|
||||||
DelayChangeTheme();
|
|
||||||
UserSettingStorage.Instance.Save();
|
UserSettingStorage.Instance.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DelayChangeTheme()
|
|
||||||
{
|
|
||||||
Dispatcher.DelayInvoke("delayChangeTheme", () =>
|
|
||||||
{
|
|
||||||
ThemeManager.Theme.ChangeTheme(UserSettingStorage.Instance.Theme);
|
|
||||||
WindowIntelopHelper.SetBlurForWindow(MainWindow, UserSettingStorage.Instance.ThemeBlurEnabled);
|
|
||||||
}, TimeSpan.FromMilliseconds(100));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CbQueryBoxFontFaces_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void CbQueryBoxFontFaces_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!settingsLoaded) return;
|
if (!settingsLoaded) return;
|
||||||
@ -481,7 +469,6 @@ namespace Wox
|
|||||||
UserSettingStorage.Instance.QueryBoxFontWeight = typeface.Weight.ToString();
|
UserSettingStorage.Instance.QueryBoxFontWeight = typeface.Weight.ToString();
|
||||||
UserSettingStorage.Instance.QueryBoxFontStyle = typeface.Style.ToString();
|
UserSettingStorage.Instance.QueryBoxFontStyle = typeface.Style.ToString();
|
||||||
UserSettingStorage.Instance.Save();
|
UserSettingStorage.Instance.Save();
|
||||||
DelayChangeTheme();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,9 +478,7 @@ namespace Wox
|
|||||||
string resultItemFont = cbResultItemFont.SelectedItem.ToString();
|
string resultItemFont = cbResultItemFont.SelectedItem.ToString();
|
||||||
UserSettingStorage.Instance.ResultItemFont = resultItemFont;
|
UserSettingStorage.Instance.ResultItemFont = resultItemFont;
|
||||||
this.cbResultItemFontFaces.SelectedItem = ((FontFamily)cbResultItemFont.SelectedItem).ChooseRegularFamilyTypeface();
|
this.cbResultItemFontFaces.SelectedItem = ((FontFamily)cbResultItemFont.SelectedItem).ChooseRegularFamilyTypeface();
|
||||||
|
|
||||||
UserSettingStorage.Instance.Save();
|
UserSettingStorage.Instance.Save();
|
||||||
DelayChangeTheme();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CbResultItemFontFaces_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void CbResultItemFontFaces_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
@ -511,7 +496,6 @@ namespace Wox
|
|||||||
UserSettingStorage.Instance.ResultItemFontWeight = typeface.Weight.ToString();
|
UserSettingStorage.Instance.ResultItemFontWeight = typeface.Weight.ToString();
|
||||||
UserSettingStorage.Instance.ResultItemFontStyle = typeface.Style.ToString();
|
UserSettingStorage.Instance.ResultItemFontStyle = typeface.Style.ToString();
|
||||||
UserSettingStorage.Instance.Save();
|
UserSettingStorage.Instance.Save();
|
||||||
DelayChangeTheme();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,10 +27,6 @@
|
|||||||
<Setter Property="Stroke" Value="Blue" />
|
<Setter Property="Stroke" Value="Blue" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
|
||||||
<system:Boolean x:Key="ThemeBlurEnabled">false</system:Boolean>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Item Style -->
|
<!-- Item Style -->
|
||||||
<Style x:Key="BaseItemTitleStyle" TargetType="{x:Type TextBlock}">
|
<Style x:Key="BaseItemTitleStyle" TargetType="{x:Type TextBlock}">
|
||||||
<Setter Property="Foreground" Value="#FFFFF8" />
|
<Setter Property="Foreground" Value="#FFFFF8" />
|
||||||
|
@ -8,39 +8,37 @@
|
|||||||
<system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean>
|
<system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean>
|
||||||
|
|
||||||
<Style x:Key="QueryBoxStyle" BasedOn="{StaticResource BaseQueryBoxStyle}" TargetType="{x:Type TextBox}">
|
<Style x:Key="QueryBoxStyle" BasedOn="{StaticResource BaseQueryBoxStyle}" TargetType="{x:Type TextBox}">
|
||||||
<Setter Property="Foreground" Value="#FFFFFFFF" />
|
<Setter Property="Foreground" Value="#FFFFFFFF" />
|
||||||
<Setter Property="Background" Value="#01000001" />
|
<Setter Property="Background" Value="#01000001" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="WindowBorderStyle" BasedOn="{StaticResource BaseWindowBorderStyle}" TargetType="{x:Type Border}">
|
<Style x:Key="WindowBorderStyle" BasedOn="{StaticResource BaseWindowBorderStyle}" TargetType="{x:Type Border}">
|
||||||
<Setter Property="Background" Value="#CC000000" />
|
<Setter Property="Background" Value="#CC000000" />
|
||||||
<Setter Property="BorderBrush" Value="#50FFFFFF" />
|
<Setter Property="BorderBrush" Value="#50FFFFFF" />
|
||||||
<Setter Property="BorderThickness" Value="10" />
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
|
|
||||||
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="WindowStyle" BasedOn="{StaticResource BaseWindowStyle}" TargetType="{x:Type Window}">
|
<Style x:Key="WindowStyle" BasedOn="{StaticResource BaseWindowStyle}" TargetType="{x:Type Window}">
|
||||||
<Setter Property="Background" Value="#01000001"></Setter>
|
<Setter Property="Background" Value="#01000001"></Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="PendingLineStyle" BasedOn="{StaticResource BasePendingLineStyle}" TargetType="{x:Type Line}">
|
<Style x:Key="PendingLineStyle" BasedOn="{StaticResource BasePendingLineStyle}" TargetType="{x:Type Line}">
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- Item Style -->
|
<!-- Item Style -->
|
||||||
<Style x:Key="ItemTitleStyle" BasedOn="{StaticResource BaseItemTitleStyle}" TargetType="{x:Type TextBlock}">
|
<Style x:Key="ItemTitleStyle" BasedOn="{StaticResource BaseItemTitleStyle}" TargetType="{x:Type TextBlock}">
|
||||||
<Setter Property="Margin" Value="0, -10"/>
|
<Setter Property="Margin" Value="0, -10"/>
|
||||||
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="ItemSubTitleStyle" BasedOn="{StaticResource BaseItemSubTitleStyle}" TargetType="{x:Type TextBlock}" >
|
<Style x:Key="ItemSubTitleStyle" BasedOn="{StaticResource BaseItemSubTitleStyle}" TargetType="{x:Type TextBlock}" >
|
||||||
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="ItemTitleSelectedStyle" BasedOn="{StaticResource BaseItemTitleSelectedStyle}" TargetType="{x:Type TextBlock}" >
|
<Style x:Key="ItemTitleSelectedStyle" BasedOn="{StaticResource BaseItemTitleSelectedStyle}" TargetType="{x:Type TextBlock}" >
|
||||||
<Setter Property="Margin" Value="0, -10"/>
|
<Setter Property="Margin" Value="0, -10"/>
|
||||||
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="ItemSubTitleSelectedStyle" BasedOn="{StaticResource BaseItemSubTitleSelectedStyle}" TargetType="{x:Type TextBlock}" >
|
<Style x:Key="ItemSubTitleSelectedStyle" BasedOn="{StaticResource BaseItemSubTitleSelectedStyle}" TargetType="{x:Type TextBlock}" >
|
||||||
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Color x:Key="ItemSelectedBackgroundColor">#356ef3</Color>
|
<Color x:Key="ItemSelectedBackgroundColor">#356ef3</Color>
|
||||||
|
|
||||||
@ -49,6 +47,6 @@
|
|||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="ScrollBarStyle" BasedOn="{StaticResource BaseScrollBarStyle}" TargetType="{x:Type ScrollBar}">
|
<Style x:Key="ScrollBarStyle" BasedOn="{StaticResource BaseScrollBarStyle}" TargetType="{x:Type ScrollBar}">
|
||||||
<Setter Property="Background" Value="#a0a0a0"/>
|
<Setter Property="Background" Value="#a0a0a0"/>
|
||||||
</Style>
|
</Style>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
@ -8,39 +8,37 @@
|
|||||||
<system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean>
|
<system:Boolean x:Key="ThemeBlurEnabled">True</system:Boolean>
|
||||||
|
|
||||||
<Style x:Key="QueryBoxStyle" BasedOn="{StaticResource BaseQueryBoxStyle}" TargetType="{x:Type TextBox}">
|
<Style x:Key="QueryBoxStyle" BasedOn="{StaticResource BaseQueryBoxStyle}" TargetType="{x:Type TextBox}">
|
||||||
<Setter Property="Foreground" Value="#FF000000" />
|
<Setter Property="Foreground" Value="#FF000000" />
|
||||||
<Setter Property="Background" Value="#01FFFFFF" />
|
<Setter Property="Background" Value="#01FFFFFF" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="WindowBorderStyle" BasedOn="{StaticResource BaseWindowBorderStyle}" TargetType="{x:Type Border}">
|
<Style x:Key="WindowBorderStyle" BasedOn="{StaticResource BaseWindowBorderStyle}" TargetType="{x:Type Border}">
|
||||||
<Setter Property="Background" Value="#CCFFFFFF" />
|
<Setter Property="Background" Value="#CCFFFFFF" />
|
||||||
<Setter Property="BorderBrush" Value="#70000000" />
|
<Setter Property="BorderBrush" Value="#70000000" />
|
||||||
<Setter Property="BorderThickness" Value="10" />
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
|
|
||||||
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="WindowStyle" BasedOn="{StaticResource BaseWindowStyle}" TargetType="{x:Type Window}">
|
<Style x:Key="WindowStyle" BasedOn="{StaticResource BaseWindowStyle}" TargetType="{x:Type Window}">
|
||||||
<Setter Property="Background" Value="#01FFFFFF"></Setter>
|
<Setter Property="Background" Value="#01FFFFFF"></Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="PendingLineStyle" BasedOn="{StaticResource BasePendingLineStyle}" TargetType="{x:Type Line}">
|
<Style x:Key="PendingLineStyle" BasedOn="{StaticResource BasePendingLineStyle}" TargetType="{x:Type Line}">
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- Item Style -->
|
<!-- Item Style -->
|
||||||
<Style x:Key="ItemTitleStyle" BasedOn="{StaticResource BaseItemTitleStyle}" TargetType="{x:Type TextBlock}">
|
<Style x:Key="ItemTitleStyle" BasedOn="{StaticResource BaseItemTitleStyle}" TargetType="{x:Type TextBlock}">
|
||||||
<Setter Property="Margin" Value="0, -10"/>
|
<Setter Property="Margin" Value="0, -10"/>
|
||||||
<Setter Property="Foreground" Value="#FF000000"/>
|
<Setter Property="Foreground" Value="#FF000000"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="ItemSubTitleStyle" BasedOn="{StaticResource BaseItemSubTitleStyle}" TargetType="{x:Type TextBlock}" >
|
<Style x:Key="ItemSubTitleStyle" BasedOn="{StaticResource BaseItemSubTitleStyle}" TargetType="{x:Type TextBlock}" >
|
||||||
<Setter Property="Foreground" Value="#FF000000"/>
|
<Setter Property="Foreground" Value="#FF000000"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="ItemTitleSelectedStyle" BasedOn="{StaticResource BaseItemTitleSelectedStyle}" TargetType="{x:Type TextBlock}" >
|
<Style x:Key="ItemTitleSelectedStyle" BasedOn="{StaticResource BaseItemTitleSelectedStyle}" TargetType="{x:Type TextBlock}" >
|
||||||
<Setter Property="Margin" Value="0, -10"/>
|
<Setter Property="Margin" Value="0, -10"/>
|
||||||
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="ItemSubTitleSelectedStyle" BasedOn="{StaticResource BaseItemSubTitleSelectedStyle}" TargetType="{x:Type TextBlock}" >
|
<Style x:Key="ItemSubTitleSelectedStyle" BasedOn="{StaticResource BaseItemSubTitleSelectedStyle}" TargetType="{x:Type TextBlock}" >
|
||||||
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
||||||
</Style>
|
</Style>
|
||||||
<Color x:Key="ItemSelectedBackgroundColor">#356ef3</Color>
|
<Color x:Key="ItemSelectedBackgroundColor">#356ef3</Color>
|
||||||
|
|
||||||
@ -49,6 +47,6 @@
|
|||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="ScrollBarStyle" BasedOn="{StaticResource BaseScrollBarStyle}" TargetType="{x:Type ScrollBar}">
|
<Style x:Key="ScrollBarStyle" BasedOn="{StaticResource BaseScrollBarStyle}" TargetType="{x:Type ScrollBar}">
|
||||||
<Setter Property="Background" Value="#a0a0a0"/>
|
<Setter Property="Background" Value="#a0a0a0"/>
|
||||||
</Style>
|
</Style>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
Loading…
Reference in New Issue
Block a user