Get SystemVersionInfo with Interop

This commit is contained in:
Mahdi Hosseini committed 2020-07-28 22:06:45 +04:30
1 parent c46f8a754c
commit 0fe47b2925
6 files changed
+27 -8

No files matched your search

@@ -13,10 +13,18 @@ namespace HandyControl.Controls
base.OnApplyTemplate();
EnableBlur(this);
}
private 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);
}
internal static void EnableBlur(Window window)
{
var versionInfo = ConfigHelper.Instance.SystemVersionInfo;
var versionInfo = GetSystemVersionInfo();
if (versionInfo < SystemVersionInfo.Windows10 ||
versionInfo >= SystemVersionInfo.Windows10_1903)