Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01f28cf044 |
+8
-10
@@ -2,6 +2,7 @@ using Microsoft.Win32;
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace ClaudeCheckerWindows;
|
namespace ClaudeCheckerWindows;
|
||||||
|
|
||||||
@@ -14,20 +15,17 @@ public static class ThemeManager
|
|||||||
{
|
{
|
||||||
IsDark = ReadIsDark();
|
IsDark = ReadIsDark();
|
||||||
Apply();
|
Apply();
|
||||||
SystemEvents.UserPreferenceChanged += OnPreferenceChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void OnPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
|
var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(5) };
|
||||||
{
|
timer.Tick += (_, _) =>
|
||||||
if (e.Category != UserPreferenceCategory.General) return;
|
|
||||||
var nowDark = ReadIsDark();
|
|
||||||
if (nowDark == IsDark) return;
|
|
||||||
IsDark = nowDark;
|
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
|
||||||
{
|
{
|
||||||
|
var nowDark = ReadIsDark();
|
||||||
|
if (nowDark == IsDark) return;
|
||||||
|
IsDark = nowDark;
|
||||||
Apply();
|
Apply();
|
||||||
ThemeChanged?.Invoke();
|
ThemeChanged?.Invoke();
|
||||||
});
|
};
|
||||||
|
timer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ReadIsDark()
|
private static bool ReadIsDark()
|
||||||
|
|||||||
Reference in New Issue
Block a user