fixed .net 4.0 compile problem
This commit is contained in:
1 parent
95694e7e27
commit
01c41422f8
3 files changed
+18
-11
No files matched your search
@@ -5,6 +5,7 @@ using System.Windows.Media;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools;
|
||||
using HandyControl.Tools.Helper;
|
||||
using HandyControl.Tools.Interop;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace HandyControl.Themes
|
||||
@@ -191,25 +192,26 @@ namespace HandyControl.Themes
|
||||
{
|
||||
if (AccentColor != null)
|
||||
{
|
||||
_precSkin[ResourceToken.PrimaryColor] = AccentColor;
|
||||
_precSkin[ResourceToken.DarkPrimaryColor] = AccentColor;
|
||||
_precSkin[ResourceToken.TitleColor] = AccentColor;
|
||||
_precSkin[ResourceToken.SecondaryTitleColor] = AccentColor;
|
||||
UpdateAccentColor(AccentColor.Value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var windowGlassColor = ((SolidColorBrush) SystemParameters.WindowGlassBrush).Color;
|
||||
|
||||
_precSkin[ResourceToken.PrimaryColor] = windowGlassColor;
|
||||
_precSkin[ResourceToken.DarkPrimaryColor] = windowGlassColor;
|
||||
_precSkin[ResourceToken.TitleColor] = windowGlassColor;
|
||||
_precSkin[ResourceToken.SecondaryTitleColor] = windowGlassColor;
|
||||
InteropMethods.DwmGetColorizationColor(out var color, out _);
|
||||
UpdateAccentColor(ColorHelper.ToColor(color));
|
||||
}
|
||||
|
||||
return _precSkin;
|
||||
}
|
||||
|
||||
private void UpdateAccentColor(Color color)
|
||||
{
|
||||
_precSkin[ResourceToken.PrimaryColor] = color;
|
||||
_precSkin[ResourceToken.DarkPrimaryColor] = color;
|
||||
_precSkin[ResourceToken.TitleColor] = color;
|
||||
_precSkin[ResourceToken.SecondaryTitleColor] = color;
|
||||
}
|
||||
|
||||
private void UpdateSkin() => MergedDictionaries[0] = GetSkin(Skin);
|
||||
|
||||
public virtual ResourceDictionary GetTheme() => ResourceHelper.GetTheme();
|
||||
|
||||
@@ -480,6 +480,10 @@ namespace HandyControl.Tools.Interop
|
||||
[DllImport(InteropValues.ExternDll.Shell32, CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern uint SHAppBarMessage(int dwMessage, ref InteropValues.APPBARDATA pData);
|
||||
|
||||
[SecurityCritical]
|
||||
[DllImport(InteropValues.ExternDll.DwmApi, EntryPoint = "DwmGetColorizationColor", PreserveSig = true)]
|
||||
internal static extern int DwmGetColorizationColor(out uint pcrColorization, out bool pfOpaqueBlend);
|
||||
|
||||
#endregion
|
||||
|
||||
internal class Gdip
|
||||
|
||||
@@ -18,7 +18,8 @@ namespace HandyControl.Tools.Interop
|
||||
Kernel32 = "kernel32.dll",
|
||||
Shell32 = "shell32.dll",
|
||||
MsImg = "msimg32.dll",
|
||||
NTdll = "ntdll.dll";
|
||||
NTdll = "ntdll.dll",
|
||||
DwmApi = "dwmapi.dll";
|
||||
}
|
||||
|
||||
internal delegate IntPtr HookProc(int code, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
Reference in new issue
Block a user