From 0529ac4876ec74b15a25b7260a25dc00a1a132ca Mon Sep 17 00:00:00 2001
From: Hublack <71221641+HublackBE@users.noreply.github.com>
Date: Mon, 12 Jan 2026 21:32:01 +0100
Subject: [PATCH 1/2] Improve service sorting options and logic in UI/backend
Added "Active State" sorting to Services UI. Enhanced sorting logic in ServicesPage.xaml.cs to prioritize enabled/disabled and running/sleeping states for "Name", "State", and default sorting. Implemented new "ActiveState" sorting. Removed "Uptime" sorting from Processes UI.
---
.../srvMgnt/Views/ProcessesPage.xaml | 2 +-
.../srvMgnt/Views/ServicesPage.xaml | 1 +
.../srvMgnt/Views/ServicesPage.xaml.cs | 46 ++++++++++++++++++-
3 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ProcessesPage.xaml b/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ProcessesPage.xaml
index cbc3ec6..f7fea01 100644
--- a/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ProcessesPage.xaml
+++ b/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ProcessesPage.xaml
@@ -28,7 +28,7 @@
Default
Name
Process ID
- Uptime
+
State
diff --git a/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ServicesPage.xaml b/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ServicesPage.xaml
index a225039..e3a0e6f 100644
--- a/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ServicesPage.xaml
+++ b/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ServicesPage.xaml
@@ -29,6 +29,7 @@
Default
Name
State
+ Active State
diff --git a/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ServicesPage.xaml.cs b/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ServicesPage.xaml.cs
index c7e8d66..48099ac 100644
--- a/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ServicesPage.xaml.cs
+++ b/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ServicesPage.xaml.cs
@@ -549,8 +549,42 @@ private void Order_Services()
List ordered = order switch
{
- "Name" => services.OrderBy(s => s.Name).ThenBy(s => s.Description).ToList(),
- "State" => services.OrderBy(p => p.State).ThenBy(s => s.Name).ToList(),
+ "Name" => services.OrderBy(s => s.Name).ThenBy(s =>
+ {
+ if (!string.IsNullOrEmpty(s.State) && s.State.Contains("enabled", StringComparison.InvariantCultureIgnoreCase))
+ return 0;
+ if (!string.IsNullOrEmpty(s.State) && s.State.Contains("disabled", StringComparison.InvariantCultureIgnoreCase))
+ return 1;
+ return 2;
+ })
+ .ThenBy(s => s.State)
+ .ThenBy(s => s.ActiveState)
+ .ToList(),
+ "State" => services.OrderBy(p =>
+ {
+ if (!string.IsNullOrEmpty(p.State) && p.State.Contains("enabled", StringComparison.InvariantCultureIgnoreCase))
+ return 0;
+ if (!string.IsNullOrEmpty(p.State) && p.State.Contains("disabled", StringComparison.InvariantCultureIgnoreCase))
+ return 1;
+ return 2;
+
+ })
+ .ThenBy(s => s.State)
+ .ThenBy(s => s.Name)
+ .ToList(),
+ "ActiveState" => services.OrderBy(s => s.ActiveState, StringComparer.InvariantCultureIgnoreCase)
+ .ThenBy(s =>
+ {
+ if (!string.IsNullOrEmpty(s.State) && s.State.Contains("running", StringComparison.InvariantCultureIgnoreCase))
+ return 0;
+ if (!string.IsNullOrEmpty(s.State) && s.State.Contains("sleeping", StringComparison.InvariantCultureIgnoreCase))
+ return 1;
+ return 2;
+ })
+ .ThenBy(s => s.ActiveState)
+ .ThenBy(s => s.State, StringComparer.InvariantCultureIgnoreCase)
+ .ThenBy(s => s.Name, StringComparer.InvariantCultureIgnoreCase)
+ .ToList(),
_ => services
.OrderBy(s =>
{
@@ -560,6 +594,14 @@ private void Order_Services()
return 1;
return 2;
})
+ .ThenBy(s =>
+ {
+ if(!string.IsNullOrEmpty(s.ActiveState) && s.ActiveState.Contains("running", StringComparison.InvariantCultureIgnoreCase))
+ return 0;
+ if (!string.IsNullOrEmpty(s.ActiveState) && s.ActiveState.Contains("sleeping", StringComparison.InvariantCultureIgnoreCase))
+ return 1;
+ return 2;
+ })
.ThenBy(s => s.State, StringComparer.InvariantCultureIgnoreCase)
.ThenBy(s => s.Name, StringComparer.InvariantCultureIgnoreCase)
.ToList()
From 8974a0ceffcd2edbfe6ebaf8bd7bb4d79c3d777e Mon Sep 17 00:00:00 2001
From: Hublack <71221641+HublackBE@users.noreply.github.com>
Date: Mon, 12 Jan 2026 21:43:09 +0100
Subject: [PATCH 2/2] Update service state colors and fix ActiveState sorting
Changed "exited" service state color to critical background for better visibility. Corrected sorting logic to use ActiveState property instead of State when ordering by "ActiveState", ensuring accurate prioritization of running and sleeping services.
---
.../srvMgnt/Views/ServicesPage.xaml.cs | 20 ++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ServicesPage.xaml.cs b/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ServicesPage.xaml.cs
index 48099ac..76d2a18 100644
--- a/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ServicesPage.xaml.cs
+++ b/src/paradigm-ehb.CommandCenter.WinUI/srvMgnt/Views/ServicesPage.xaml.cs
@@ -429,7 +429,7 @@ private async Task LoadAllServices(CancellationToken cancellationToken = default
SolidColorBrush activeStateFill = unit.ActiveState switch
{
"running" => (SolidColorBrush)Application.Current.Resources["SystemFillColorSuccessBrush"],
- "exited" => (SolidColorBrush)Application.Current.Resources["SystemFillColorNeutralBrush"],
+ "exited" => (SolidColorBrush)Application.Current.Resources["SystemFillColorCriticalBackgroundBrush"],
"dead" => (SolidColorBrush)Application.Current.Resources["SystemFillColorNeutralBrush"],
"failed" => (SolidColorBrush)Application.Current.Resources["SystemFillColorCriticalBackgroundBrush"],
_ => new SolidColorBrush(Colors.Goldenrod)
@@ -572,12 +572,11 @@ private void Order_Services()
.ThenBy(s => s.State)
.ThenBy(s => s.Name)
.ToList(),
- "ActiveState" => services.OrderBy(s => s.ActiveState, StringComparer.InvariantCultureIgnoreCase)
- .ThenBy(s =>
+ "ActiveState" => services.OrderBy(s =>
{
- if (!string.IsNullOrEmpty(s.State) && s.State.Contains("running", StringComparison.InvariantCultureIgnoreCase))
+ if (!string.IsNullOrEmpty(s.ActiveState) && s.ActiveState.Contains("running", StringComparison.InvariantCultureIgnoreCase))
return 0;
- if (!string.IsNullOrEmpty(s.State) && s.State.Contains("sleeping", StringComparison.InvariantCultureIgnoreCase))
+ if (!string.IsNullOrEmpty(s.ActiveState) && s.ActiveState.Contains("sleeping", StringComparison.InvariantCultureIgnoreCase))
return 1;
return 2;
})
@@ -607,11 +606,14 @@ private void Order_Services()
.ToList()
};
- services.Clear();
- foreach (ServiceInfo process in ordered)
+ DispatcherQueue.EnqueueAsync(() =>
{
- services.Add(process);
- }
+ services.Clear();
+ foreach (ServiceInfo process in ordered)
+ {
+ services.Add(process);
+ }
+ });
}
private async Task ShowInfoBarAsync(string title, string message, InfoBarSeverity severity)