Perf/professional hardening (#4)
* Improve background refresh and process detection * Harden affinity and power plan automation * Fix passive process refresh failures * Improve UX terminology and process layout * Polish UX layout and empty states * Expand core service test coverage
This commit is contained in:
@@ -26,6 +26,7 @@ namespace ThreadPilot.ViewModels
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using ThreadPilot.Models;
|
||||
using ThreadPilot.Services;
|
||||
|
||||
@@ -43,6 +44,7 @@ namespace ThreadPilot.ViewModels
|
||||
private readonly ICoreMaskService coreMaskService;
|
||||
private readonly IProcessPowerPlanAssociationService associationService;
|
||||
private readonly IGameModeService gameModeService;
|
||||
private readonly IAffinityApplyService affinityApplyService;
|
||||
private System.Timers.Timer? refreshTimer;
|
||||
private bool isUiRefreshPaused;
|
||||
private bool isProcessViewActive = true;
|
||||
@@ -51,7 +53,6 @@ namespace ThreadPilot.ViewModels
|
||||
private bool isApplyingFilter;
|
||||
private bool filterRefreshPending;
|
||||
private bool suppressCoreSelectionEvents;
|
||||
private bool hasPendingAffinityEdits;
|
||||
|
||||
[ObservableProperty]
|
||||
private ObservableCollection<ProcessModel> processes = new();
|
||||
@@ -85,6 +86,18 @@ namespace ThreadPilot.ViewModels
|
||||
[ObservableProperty]
|
||||
private CoreMask? selectedCoreMask;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool hasPendingAffinityEdits;
|
||||
|
||||
[ObservableProperty]
|
||||
private string currentAffinityText = "Current OS affinity: no process selected";
|
||||
|
||||
[ObservableProperty]
|
||||
private string pendingAffinityText = "Pending core mask: none";
|
||||
|
||||
[ObservableProperty]
|
||||
private string affinityEditStateText = "Select a process to view its current Windows affinity.";
|
||||
|
||||
[ObservableProperty]
|
||||
private bool isTopologyDetectionSuccessful = false;
|
||||
|
||||
@@ -163,6 +176,7 @@ namespace ThreadPilot.ViewModels
|
||||
ICoreMaskService coreMaskService,
|
||||
IProcessPowerPlanAssociationService associationService,
|
||||
IGameModeService gameModeService,
|
||||
IAffinityApplyService? affinityApplyService = null,
|
||||
IEnhancedLoggingService? enhancedLoggingService = null)
|
||||
: base(logger, enhancedLoggingService)
|
||||
{
|
||||
@@ -176,6 +190,10 @@ namespace ThreadPilot.ViewModels
|
||||
this.coreMaskService = coreMaskService ?? throw new ArgumentNullException(nameof(coreMaskService));
|
||||
this.associationService = associationService ?? throw new ArgumentNullException(nameof(associationService));
|
||||
this.gameModeService = gameModeService ?? throw new ArgumentNullException(nameof(gameModeService));
|
||||
this.affinityApplyService = affinityApplyService ?? new AffinityApplyService(
|
||||
this.processService,
|
||||
this.cpuTopologyService,
|
||||
NullLogger<AffinityApplyService>.Instance);
|
||||
|
||||
// Subscribe to topology detection events
|
||||
this.cpuTopologyService.TopologyDetected += this.OnTopologyDetected;
|
||||
|
||||
Reference in New Issue
Block a user