Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c8e0dcdb6 | ||
|
|
0010051ede | ||
|
|
98bd736a66 | ||
|
|
251efdbb0b | ||
|
|
f219b65650 | ||
|
|
b0907d17b5 | ||
|
|
d3aa3dc6bd |
+12
-8
@@ -3,13 +3,17 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
ShutdownMode="OnExplicitShutdown">
|
||||
<Application.Resources>
|
||||
<SolidColorBrush x:Key="BackgroundBrush" Color="#F3F3F3"/>
|
||||
<SolidColorBrush x:Key="CardBrush" Color="#FFFFFF"/>
|
||||
<SolidColorBrush x:Key="AccentBrush" Color="#F97316"/>
|
||||
<SolidColorBrush x:Key="TextBrush" Color="#1C1C1C"/>
|
||||
<SolidColorBrush x:Key="SecondaryBrush" Color="#6E6E6E"/>
|
||||
<SolidColorBrush x:Key="BorderBrush" Color="#E0E0E0"/>
|
||||
<SolidColorBrush x:Key="BlueBrush" Color="#0078D4"/>
|
||||
<SolidColorBrush x:Key="BackgroundBrush" Color="#F3F3F3"/>
|
||||
<SolidColorBrush x:Key="CardBrush" Color="#FFFFFF"/>
|
||||
<SolidColorBrush x:Key="AccentBrush" Color="#F97316"/>
|
||||
<SolidColorBrush x:Key="TextBrush" Color="#1C1C1C"/>
|
||||
<SolidColorBrush x:Key="SecondaryBrush" Color="#6E6E6E"/>
|
||||
<SolidColorBrush x:Key="BorderBrush" Color="#E0E0E0"/>
|
||||
<SolidColorBrush x:Key="BlueBrush" Color="#0078D4"/>
|
||||
<SolidColorBrush x:Key="ButtonBrush" Color="#FFFFFF"/>
|
||||
<SolidColorBrush x:Key="SurfaceBrush" Color="#FAFAFA"/>
|
||||
<SolidColorBrush x:Key="BannerBgBrush" Color="#E8F2FB"/>
|
||||
<SolidColorBrush x:Key="BannerBorderBrush" Color="#B3D6F5"/>
|
||||
|
||||
<Style x:Key="HeaderText" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="10"/>
|
||||
@@ -48,7 +52,7 @@
|
||||
</Style>
|
||||
|
||||
<Style x:Key="SmallButton" TargetType="Button">
|
||||
<Setter Property="Background" Value="#FFFFFF"/>
|
||||
<Setter Property="Background" Value="{StaticResource ButtonBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource TextBrush}"/>
|
||||
|
||||
@@ -18,6 +18,7 @@ public partial class App : Application
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
base.OnStartup(e);
|
||||
ThemeManager.Initialize();
|
||||
SetupTray();
|
||||
ScheduleTimer(ViewModel.RefreshInterval);
|
||||
|
||||
|
||||
@@ -21,6 +21,11 @@ public class GaugeControl : FrameworkElement
|
||||
public double Percent { get => (double)GetValue(PercentProperty); set => SetValue(PercentProperty, value); }
|
||||
public Brush Accent { get => (Brush)GetValue(AccentProperty); set => SetValue(AccentProperty, value); }
|
||||
|
||||
public GaugeControl()
|
||||
{
|
||||
ThemeManager.ThemeChanged += InvalidateVisual;
|
||||
}
|
||||
|
||||
private const double StartAngleDeg = 135;
|
||||
private const double SweepDeg = 270;
|
||||
private const double StrokeWidth = 6;
|
||||
@@ -31,8 +36,11 @@ public class GaugeControl : FrameworkElement
|
||||
var cy = RenderSize.Height / 2;
|
||||
var radius = Math.Min(cx, cy) - StrokeWidth / 2 - 1;
|
||||
|
||||
var trackColor = ThemeManager.IsDark
|
||||
? Color.FromArgb(40, 255, 255, 255)
|
||||
: Color.FromArgb(30, 0, 0, 0);
|
||||
DrawArc(dc, cx, cy, radius, StartAngleDeg, SweepDeg,
|
||||
new Pen(new SolidColorBrush(Color.FromArgb(30, 0, 0, 0)), StrokeWidth));
|
||||
new Pen(new SolidColorBrush(trackColor), StrokeWidth));
|
||||
|
||||
if (Percent > 0)
|
||||
DrawArc(dc, cx, cy, radius, StartAngleDeg, SweepDeg * (Percent / 100.0),
|
||||
@@ -40,18 +48,21 @@ public class GaugeControl : FrameworkElement
|
||||
|
||||
var dpi = VisualTreeHelper.GetDpi(this).PixelsPerDip;
|
||||
|
||||
var textColor = ThemeManager.IsDark ? Color.FromRgb(0xF5, 0xF5, 0xF5) : Color.FromRgb(0x1C, 0x1C, 0x1C);
|
||||
var subColor = Color.FromRgb(0x9E, 0x9E, 0x9E);
|
||||
|
||||
var pctText = new FormattedText(
|
||||
$"{(int)Math.Round(Percent)}%",
|
||||
CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
|
||||
new Typeface(new FontFamily("Segoe UI"), FontStyles.Normal, FontWeights.Bold, FontStretches.Normal),
|
||||
14, new SolidColorBrush(Color.FromRgb(0x1C, 0x1C, 0x1C)), dpi);
|
||||
14, new SolidColorBrush(textColor), dpi);
|
||||
dc.DrawText(pctText, new Point(cx - pctText.Width / 2, cy - pctText.Height - 1));
|
||||
|
||||
var sub = new FormattedText(
|
||||
"Updated\nnow",
|
||||
CultureInfo.CurrentCulture, FlowDirection.LeftToRight,
|
||||
new Typeface("Segoe UI"), 7,
|
||||
new SolidColorBrush(Color.FromRgb(0x9E, 0x9E, 0x9E)), dpi)
|
||||
new SolidColorBrush(subColor), dpi)
|
||||
{
|
||||
TextAlignment = TextAlignment.Center
|
||||
};
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
<!-- Update banner -->
|
||||
<Border x:Name="UpdateBanner" DockPanel.Dock="Top" Visibility="Collapsed"
|
||||
Background="#E8F2FB" BorderBrush="#B3D6F5" BorderThickness="0,0,0,1"
|
||||
Background="{StaticResource BannerBgBrush}"
|
||||
BorderBrush="{StaticResource BannerBorderBrush}" BorderThickness="0,0,0,1"
|
||||
Cursor="Hand" MouseLeftButtonUp="UpdateBanner_Click">
|
||||
<Grid Margin="16,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -39,7 +40,7 @@
|
||||
|
||||
<!-- Footer -->
|
||||
<Border DockPanel.Dock="Bottom" BorderBrush="{StaticResource BorderBrush}"
|
||||
BorderThickness="0,1,0,0" Background="#FAFAFA">
|
||||
BorderThickness="0,1,0,0" Background="{StaticResource SurfaceBrush}">
|
||||
<Grid Margin="12,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@@ -74,7 +75,7 @@
|
||||
Background="{StaticResource BackgroundBrush}">
|
||||
<DockPanel>
|
||||
<Border DockPanel.Dock="Top" BorderBrush="{StaticResource BorderBrush}"
|
||||
BorderThickness="0,0,0,1" Background="#FAFAFA" Padding="12,10">
|
||||
BorderThickness="0,0,0,1" Background="{StaticResource SurfaceBrush}" Padding="12,10">
|
||||
<Grid>
|
||||
<Button Content="← Back" HorizontalAlignment="Left"
|
||||
Style="{StaticResource SmallButton}" BorderThickness="0"
|
||||
@@ -188,7 +189,7 @@
|
||||
Background="{StaticResource BackgroundBrush}">
|
||||
<DockPanel>
|
||||
<Border DockPanel.Dock="Top" BorderBrush="{StaticResource BorderBrush}"
|
||||
BorderThickness="0,0,0,1" Background="#FAFAFA" Padding="12,10">
|
||||
BorderThickness="0,0,0,1" Background="{StaticResource SurfaceBrush}" Padding="12,10">
|
||||
<Grid>
|
||||
<Button Content="← Back" HorizontalAlignment="Left"
|
||||
Style="{StaticResource SmallButton}" BorderThickness="0"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using ClaudeCheckerWindows.Controls;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
|
||||
@@ -14,6 +16,17 @@ public partial class PopupWindow : Window
|
||||
private readonly DispatcherTimer _clockTimer;
|
||||
private bool _dialogOpen;
|
||||
|
||||
[DllImport("dwmapi.dll")]
|
||||
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int value, int size);
|
||||
|
||||
private void ApplyTitleBarTheme()
|
||||
{
|
||||
var hwnd = new WindowInteropHelper(this).Handle;
|
||||
if (hwnd == IntPtr.Zero) return;
|
||||
int dark = ThemeManager.IsDark ? 1 : 0;
|
||||
DwmSetWindowAttribute(hwnd, 20, ref dark, sizeof(int));
|
||||
}
|
||||
|
||||
public PopupWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -31,6 +44,8 @@ public partial class PopupWindow : Window
|
||||
UpdateFooter();
|
||||
|
||||
Closing += (_, e) => { e.Cancel = true; Hide(); };
|
||||
SourceInitialized += (_, _) => ApplyTitleBarTheme();
|
||||
ThemeManager.ThemeChanged += () => { ApplyTitleBarTheme(); RebuildCards(); };
|
||||
}
|
||||
|
||||
// ── Card rendering ───────────────────────────────────────────────
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace ClaudeCheckerWindows;
|
||||
|
||||
public static class ThemeManager
|
||||
{
|
||||
public static bool IsDark { get; private set; }
|
||||
public static event Action? ThemeChanged;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
IsDark = ReadIsDark();
|
||||
Apply();
|
||||
SystemEvents.UserPreferenceChanged += OnPreferenceChanged;
|
||||
}
|
||||
|
||||
private static void OnPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
|
||||
{
|
||||
if (e.Category != UserPreferenceCategory.General) return;
|
||||
var nowDark = ReadIsDark();
|
||||
if (nowDark == IsDark) return;
|
||||
IsDark = nowDark;
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Apply();
|
||||
ThemeChanged?.Invoke();
|
||||
});
|
||||
}
|
||||
|
||||
private static bool ReadIsDark()
|
||||
{
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(
|
||||
@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
|
||||
return (int)(key?.GetValue("AppsUseLightTheme") ?? 1) == 0;
|
||||
}
|
||||
catch { return false; }
|
||||
}
|
||||
|
||||
private static void Apply()
|
||||
{
|
||||
var res = Application.Current.Resources;
|
||||
if (IsDark)
|
||||
{
|
||||
Set(res, "BackgroundBrush", Color.FromRgb(0x1C, 0x1C, 0x1E));
|
||||
Set(res, "CardBrush", Color.FromRgb(0x2C, 0x2C, 0x2E));
|
||||
Set(res, "TextBrush", Color.FromRgb(0xF5, 0xF5, 0xF5));
|
||||
Set(res, "SecondaryBrush", Color.FromRgb(0x8A, 0x8A, 0x8E));
|
||||
Set(res, "BorderBrush", Color.FromRgb(0x3A, 0x3A, 0x3C));
|
||||
Set(res, "BlueBrush", Color.FromRgb(0x3B, 0x82, 0xF6));
|
||||
Set(res, "ButtonBrush", Color.FromRgb(0x3A, 0x3A, 0x3C));
|
||||
Set(res, "SurfaceBrush", Color.FromRgb(0x25, 0x25, 0x27));
|
||||
Set(res, "BannerBgBrush", Color.FromRgb(0x1A, 0x31, 0x52));
|
||||
Set(res, "BannerBorderBrush", Color.FromRgb(0x2A, 0x4A, 0x72));
|
||||
}
|
||||
else
|
||||
{
|
||||
Set(res, "BackgroundBrush", Color.FromRgb(0xF3, 0xF3, 0xF3));
|
||||
Set(res, "CardBrush", Colors.White);
|
||||
Set(res, "TextBrush", Color.FromRgb(0x1C, 0x1C, 0x1C));
|
||||
Set(res, "SecondaryBrush", Color.FromRgb(0x6E, 0x6E, 0x6E));
|
||||
Set(res, "BorderBrush", Color.FromRgb(0xE0, 0xE0, 0xE0));
|
||||
Set(res, "BlueBrush", Color.FromRgb(0x00, 0x78, 0xD4));
|
||||
Set(res, "ButtonBrush", Colors.White);
|
||||
Set(res, "SurfaceBrush", Color.FromRgb(0xFA, 0xFA, 0xFA));
|
||||
Set(res, "BannerBgBrush", Color.FromRgb(0xE8, 0xF2, 0xFB));
|
||||
Set(res, "BannerBorderBrush", Color.FromRgb(0xB3, 0xD6, 0xF5));
|
||||
}
|
||||
}
|
||||
|
||||
private static void Set(ResourceDictionary res, string key, Color color)
|
||||
{
|
||||
if (res[key] is SolidColorBrush b) b.Color = color;
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,11 @@ public class UpdateManager : INotifyPropertyChanged
|
||||
|
||||
public string CurrentVersion =>
|
||||
System.Reflection.Assembly.GetExecutingAssembly()
|
||||
.GetName().Version?.ToString(3) ?? "1.0.0";
|
||||
.GetCustomAttribute<System.Reflection.AssemblyInformationalVersionAttribute>()
|
||||
?.InformationalVersion.Split('+')[0]
|
||||
?? "1.0.0";
|
||||
|
||||
private bool IsPreReleaseBuild => CurrentVersion.Contains('-');
|
||||
|
||||
public UpdateManager()
|
||||
{
|
||||
@@ -91,7 +95,8 @@ public class UpdateManager : INotifyPropertyChanged
|
||||
LatestBetaVersion = beta.Version;
|
||||
BetaAvailable = true;
|
||||
|
||||
if (BetaChannel && IsNewer(beta.Version, LatestVersion))
|
||||
// Show beta update if user opted in, or if they're already running a beta
|
||||
if ((BetaChannel || IsPreReleaseBuild) && IsNewer(beta.Version, LatestVersion))
|
||||
{
|
||||
LatestVersion = beta.Version;
|
||||
ReleaseNotes = beta.Notes ?? "";
|
||||
|
||||
Reference in New Issue
Block a user