App icon; language/theme follow Windows on first run; flush save on exit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
26
Core/SystemPrefs.cs
Normal file
26
Core/SystemPrefs.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
#nullable enable
|
||||
using System.Globalization;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace ReminderOrganizer.Core
|
||||
{
|
||||
/// <summary>Defaults taken from Windows until the user picks something in the app.</summary>
|
||||
public static class SystemPrefs
|
||||
{
|
||||
public static string Language(CultureInfo? culture = null) =>
|
||||
(culture ?? CultureInfo.CurrentUICulture).TwoLetterISOLanguageName == "de" ? "de" : "en";
|
||||
|
||||
public static bool IsDarkMode()
|
||||
{
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
|
||||
return key?.GetValue("AppsUseLightTheme") is int v && v == 0;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user