Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0096199334 | ||
|
|
01f28cf044 |
@@ -17,6 +17,19 @@ public partial class App : Application
|
|||||||
|
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
|
var logPath = System.IO.Path.Combine(
|
||||||
|
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||||
|
"ClaudeChecker", "startup_crash.txt");
|
||||||
|
|
||||||
|
AppDomain.CurrentDomain.UnhandledException += (_, ex) =>
|
||||||
|
System.IO.File.WriteAllText(logPath, ex.ExceptionObject?.ToString() ?? "unknown");
|
||||||
|
|
||||||
|
DispatcherUnhandledException += (_, ex) =>
|
||||||
|
{
|
||||||
|
System.IO.File.WriteAllText(logPath, ex.Exception?.ToString() ?? "unknown");
|
||||||
|
ex.Handled = false;
|
||||||
|
};
|
||||||
|
|
||||||
base.OnStartup(e);
|
base.OnStartup(e);
|
||||||
ThemeManager.Initialize();
|
ThemeManager.Initialize();
|
||||||
SetupTray();
|
SetupTray();
|
||||||
|
|||||||
+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