mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-09-29 16:51:18 +13:00
[BUG] NullReferenceException when regedit key missing for darkmode (#148), version 1.0.17.9
This commit is contained in:
parent
f48306c27d
commit
6162364577
2 changed files with 15 additions and 3 deletions
|
@ -127,8 +127,20 @@ namespace SystemTrayMenu
|
||||||
private static bool IsDarkModeActive()
|
private static bool IsDarkModeActive()
|
||||||
{
|
{
|
||||||
// Check: AppsUseLightTheme (REG_DWORD)
|
// Check: AppsUseLightTheme (REG_DWORD)
|
||||||
|
bool isDarkModeActive = false;
|
||||||
|
object registryValueAppsUseLightTheme = Registry.GetValue(
|
||||||
|
"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
|
||||||
|
"AppsUseLightTheme",
|
||||||
|
1);
|
||||||
|
|
||||||
// 0 = Dark mode, 1 = Light mode
|
// 0 = Dark mode, 1 = Light mode
|
||||||
return Registry.GetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", "AppsUseLightTheme", 1).ToString() == "0";
|
if (registryValueAppsUseLightTheme != null &&
|
||||||
|
registryValueAppsUseLightTheme.ToString() == "0")
|
||||||
|
{
|
||||||
|
isDarkModeActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isDarkModeActive;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.17.8")]
|
[assembly: AssemblyVersion("1.0.17.9")]
|
||||||
[assembly: AssemblyFileVersion("1.0.17.8")]
|
[assembly: AssemblyFileVersion("1.0.17.9")]
|
||||||
|
|
Loading…
Reference in a new issue