support for sync with system theme
This commit is contained in:
1 parent
d997aee5f7
commit
3da5662a90
10 files changed
+111
-46
No files matched your search
@@ -0,0 +1,29 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools.Interop;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace HandyControl.Tools.Helper
|
||||
{
|
||||
internal class SystemHelper
|
||||
{
|
||||
public static SystemVersionInfo GetSystemVersionInfo()
|
||||
{
|
||||
var osv = new InteropValues.RTL_OSVERSIONINFOEX();
|
||||
osv.dwOSVersionInfoSize = (uint) Marshal.SizeOf(osv);
|
||||
InteropMethods.Gdip.RtlGetVersion(out osv);
|
||||
return new SystemVersionInfo((int) osv.dwMajorVersion, (int) osv.dwMinorVersion, (int) osv.dwBuildNumber);
|
||||
}
|
||||
|
||||
private const string SkinTypeRegistryKeyName = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize";
|
||||
|
||||
private const string SkinTypeRegistryValueName = "AppsUseLightTheme";
|
||||
|
||||
public static bool DetermineIfInLightThemeMode()
|
||||
{
|
||||
var value = Registry.GetValue(SkinTypeRegistryKeyName, SkinTypeRegistryValueName, "0");
|
||||
|
||||
return value != null && value.ToString() != "0";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user