mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-20 19:30:31 +12:00
[BUG] NullReferenceException when regedit key missing for darkmode (#148), version 1.0.17.9
This commit is contained in:
parent
f48306c27d
commit
6162364577
|
@ -127,8 +127,20 @@ namespace SystemTrayMenu
|
|||
private static bool IsDarkModeActive()
|
||||
{
|
||||
// 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
|
||||
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
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.17.8")]
|
||||
[assembly: AssemblyFileVersion("1.0.17.8")]
|
||||
[assembly: AssemblyVersion("1.0.17.9")]
|
||||
[assembly: AssemblyFileVersion("1.0.17.9")]
|
||||
|
|
Loading…
Reference in a new issue