Skip to content

Commit 7492289

Browse files
committed
Adopt Wpf.Ui FluentWindow and revamp UI
Replace Window with Wpf.Ui FluentWindow and integrate Wpf.Ui theme dictionaries and controls; migrate main navigation from TabControl to NavigationView with TitleBar, navigation items and view visibility management, improved startup overlay with blur/fade animations, and updated status bar. Converters now resolve brushes from application resources for theming. CpuTopologyService: add Windows API (GetLogicalProcessorInformationEx) detection, richer structures, improved HT/core type heuristics, labeling and affinity presets; fallbacks and WMI usage preserved. System tray: add ApplyTheme method, custom menu font handling and related calls. NotificationService: standardize display duration via a constant. Misc: XAML/resource adjustments, minor view/viewmodel wiring, and .gitignore updated to include implementation_plan.md.
1 parent 4865b62 commit 7492289

25 files changed

Lines changed: 1633 additions & 1251 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,4 @@ PROJECT_STRUCTURE.md
132132
TRADEMARK.md
133133
UI_STYLE_GUIDE.md
134134
COMPLIANCE_AUDIT.md
135+
implementation_plan.md

App.xaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
<Application x:Class="ThreadPilot.App"
1+
<Application x:Class="ThreadPilot.App"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:local="clr-namespace:ThreadPilot"
55
xmlns:helpers="clr-namespace:ThreadPilot.Helpers"
6-
xmlns:converters="clr-namespace:ThreadPilot.Converters">
6+
xmlns:converters="clr-namespace:ThreadPilot.Converters"
7+
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
78
<Application.Resources>
89
<ResourceDictionary>
910
<ResourceDictionary.MergedDictionaries>
10-
<ResourceDictionary Source="Themes/FluentLight.xaml"/>
11+
<ui:ThemesDictionary Theme="Dark"/>
12+
<ui:ControlsDictionary/>
13+
<ResourceDictionary Source="Themes/FluentDark.xaml"/>
1114
</ResourceDictionary.MergedDictionaries>
1215
<helpers:BytesToMbConverter x:Key="BytesToMbConverter"/>
1316
<helpers:AffinityMaskConverter x:Key="AffinityMaskConverter"/>

Converters/BoolToColorConverter.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
using System;
1818
using System.Globalization;
19+
using System.Windows;
1920
using System.Windows.Data;
2021
using System.Windows.Media;
2122

@@ -27,17 +28,30 @@ public class BoolToColorConverter : IValueConverter
2728

2829
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
2930
{
30-
if (value is bool boolValue && boolValue)
31+
if (value is bool boolValue)
3132
{
32-
return new SolidColorBrush(Colors.Green);
33+
return boolValue
34+
? ResolveBrush("TextFillColorPrimaryBrush", System.Windows.Media.Brushes.Black)
35+
: ResolveBrush("TextFillColorSecondaryBrush", System.Windows.Media.Brushes.Gray);
3336
}
34-
return new SolidColorBrush(Colors.Gray);
37+
38+
return ResolveBrush("TextFillColorSecondaryBrush", System.Windows.Media.Brushes.Gray);
3539
}
3640

3741
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
3842
{
3943
throw new NotImplementedException();
4044
}
45+
46+
private static System.Windows.Media.Brush ResolveBrush(string key, System.Windows.Media.Brush fallback)
47+
{
48+
if (System.Windows.Application.Current?.TryFindResource(key) is System.Windows.Media.Brush brush)
49+
{
50+
return brush;
51+
}
52+
53+
return fallback;
54+
}
4155
}
4256
}
4357

Converters/CpuTopologyConverters.cs

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,41 @@ public class CoreTypeToColorConverter : IMultiValueConverter
3030
{
3131
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
3232
{
33-
if (values.Length < 2) return System.Windows.Media.Brushes.Black;
33+
if (values.Length < 2) return ResolveBrush("TextFillColorPrimaryBrush", System.Windows.Media.Brushes.Black);
3434

3535
var coreType = values[0] as CpuCoreType? ?? CpuCoreType.Unknown;
3636
var isHyperThreaded = values[1] as bool? ?? false;
3737

3838
return coreType switch
3939
{
40-
CpuCoreType.PerformanceCore => isHyperThreaded ? System.Windows.Media.Brushes.DarkBlue : System.Windows.Media.Brushes.Blue,
41-
CpuCoreType.EfficiencyCore => isHyperThreaded ? System.Windows.Media.Brushes.DarkGreen : System.Windows.Media.Brushes.Green,
40+
CpuCoreType.PerformanceCore => isHyperThreaded
41+
? ResolveBrush("SystemAccentColorSecondaryBrush", System.Windows.Media.Brushes.DodgerBlue)
42+
: ResolveBrush("SystemAccentColorPrimaryBrush", System.Windows.Media.Brushes.Blue),
43+
CpuCoreType.EfficiencyCore => isHyperThreaded
44+
? ResolveBrush("TextFillColorSecondaryBrush", System.Windows.Media.Brushes.DarkGray)
45+
: ResolveBrush("TextFillColorPrimaryBrush", System.Windows.Media.Brushes.Black),
4246
CpuCoreType.Zen or CpuCoreType.ZenPlus or CpuCoreType.Zen2 or CpuCoreType.Zen3 or CpuCoreType.Zen4 =>
43-
isHyperThreaded ? System.Windows.Media.Brushes.DarkRed : System.Windows.Media.Brushes.Red,
44-
_ => isHyperThreaded ? System.Windows.Media.Brushes.DarkGray : System.Windows.Media.Brushes.Black
47+
isHyperThreaded
48+
? ResolveBrush("SystemAccentColorSecondaryBrush", System.Windows.Media.Brushes.DarkOrange)
49+
: ResolveBrush("SystemAccentColorPrimaryBrush", System.Windows.Media.Brushes.Orange),
50+
_ => ResolveBrush("TextFillColorSecondaryBrush", System.Windows.Media.Brushes.Gray)
4551
};
4652
}
4753

4854
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
4955
{
5056
throw new NotImplementedException();
5157
}
58+
59+
private static System.Windows.Media.Brush ResolveBrush(string key, System.Windows.Media.Brush fallback)
60+
{
61+
if (System.Windows.Application.Current?.TryFindResource(key) is System.Windows.Media.Brush brush)
62+
{
63+
return brush;
64+
}
65+
66+
return fallback;
67+
}
5268
}
5369

5470
/// <summary>
@@ -60,15 +76,27 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
6076
{
6177
if (value is bool success)
6278
{
63-
return success ? System.Windows.Media.Brushes.Green : System.Windows.Media.Brushes.Red;
79+
return success
80+
? ResolveBrush("TextFillColorPrimaryBrush", System.Windows.Media.Brushes.Black)
81+
: ResolveBrush("TextFillColorSecondaryBrush", System.Windows.Media.Brushes.Gray);
6482
}
65-
return System.Windows.Media.Brushes.Black;
83+
return ResolveBrush("TextFillColorSecondaryBrush", System.Windows.Media.Brushes.Gray);
6684
}
6785

6886
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
6987
{
7088
throw new NotImplementedException();
7189
}
90+
91+
private static System.Windows.Media.Brush ResolveBrush(string key, System.Windows.Media.Brush fallback)
92+
{
93+
if (System.Windows.Application.Current?.TryFindResource(key) is System.Windows.Media.Brush brush)
94+
{
95+
return brush;
96+
}
97+
98+
return fallback;
99+
}
72100
}
73101

74102
/// <summary>

0 commit comments

Comments
 (0)