Add docs, themes, services and UI updates
Large changeset adding documentation, themes, converters and wiring between UI and services. Key changes: - Rewrote .gitignore to standardize build, IDE, OS and project-specific ignores. - Added comprehensive documentation: ADVANCED_CPU_FEATURES.md, API_REFERENCE.md, ARCHITECTURE_GUIDE.md, DEVELOPER_GUIDE.md, GAME_BOOST_VALIDATION.md, CLAUDE.md, PROJECT_STRUCTURE.md, UI_STYLE_GUIDE.md, TRADEMARK.md. - Added theme resources (Themes/FluentLight.xaml, Themes/FluentDark.xaml) and merged FluentLight into App.xaml resource dictionary. - Added NullToBoolConverter and registered it in App.xaml. - Enabled a DEBUG-only console test mode in App.xaml.cs (--test flag) and guarded AllocConsole with #if DEBUG. - Added new service/support files (AtomicFileWriter, StoragePaths, ThemeService) and numerous updates across Services (CpuTopologyService, CoreMaskService, PowerPlanService, ProcessMonitorManagerService, ProcessService, NotificationService, SystemTrayService, SystemTweaksService, EnhancedLoggingService, etc.). - Updated many ViewModels and Views to support new functionality (CPU topology, power plan and game-boost features) and tests (Tests/TestRunner.cs). - Added build-release.ps1 and various project metadata updates. Overall this commit introduces documentation, theming, new converters and test/debug support, plus extensive service and UI wiring for CPU topology, process monitoring, power plans and game boost features.
This commit is contained in:
@@ -159,6 +159,16 @@ namespace ThreadPilot.ViewModels
|
||||
UpdateServiceStatus();
|
||||
}
|
||||
|
||||
partial void OnSelectedAssociationChanged(ProcessPowerPlanAssociation? value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PopulateEditorFromAssociation(value);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public async Task LoadDataAsync()
|
||||
{
|
||||
@@ -242,18 +252,19 @@ namespace ThreadPilot.ViewModels
|
||||
MatchByPath = false;
|
||||
Priority = 0;
|
||||
Description = string.Empty;
|
||||
SelectedAssociation = null;
|
||||
|
||||
await LoadDataAsync();
|
||||
SetStatus("Association added successfully");
|
||||
SetStatus("Rule created and applied successfully.", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetStatus("Failed to add association - it may already exist", false);
|
||||
SetStatus("Failed to add rule - it may already exist", false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SetStatus($"Error adding association: {ex.Message}", false);
|
||||
SetStatus($"Error adding rule: {ex.Message}", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,26 +275,34 @@ namespace ThreadPilot.ViewModels
|
||||
{
|
||||
if (SelectedAssociation == null)
|
||||
{
|
||||
SetStatus("Please select an association to update", false);
|
||||
SetStatus("Please select a rule to update", false);
|
||||
return;
|
||||
}
|
||||
|
||||
SetStatus("Updating association...");
|
||||
if (string.IsNullOrWhiteSpace(NewExecutableName) || SelectedPowerPlan == null)
|
||||
{
|
||||
SetStatus("Executable and power plan are required", false);
|
||||
return;
|
||||
}
|
||||
|
||||
SetStatus("Updating rule...");
|
||||
|
||||
ApplyEditorToAssociation(SelectedAssociation);
|
||||
|
||||
var success = await _associationService.UpdateAssociationAsync(SelectedAssociation);
|
||||
if (success)
|
||||
{
|
||||
await LoadDataAsync();
|
||||
SetStatus("Association updated successfully");
|
||||
SetStatus("Rule updated and applied successfully.", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetStatus("Failed to update association", false);
|
||||
SetStatus("Failed to update rule", false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SetStatus($"Error updating association: {ex.Message}", false);
|
||||
SetStatus($"Error updating rule: {ex.Message}", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,26 +313,27 @@ namespace ThreadPilot.ViewModels
|
||||
{
|
||||
if (SelectedAssociation == null)
|
||||
{
|
||||
SetStatus("Please select an association to remove", false);
|
||||
SetStatus("Please select a rule to remove", false);
|
||||
return;
|
||||
}
|
||||
|
||||
SetStatus("Removing association...");
|
||||
SetStatus("Removing rule...");
|
||||
|
||||
var success = await _associationService.RemoveAssociationAsync(SelectedAssociation.Id);
|
||||
if (success)
|
||||
{
|
||||
SelectedAssociation = null;
|
||||
await LoadDataAsync();
|
||||
SetStatus("Association removed successfully");
|
||||
SetStatus("Rule removed successfully");
|
||||
}
|
||||
else
|
||||
{
|
||||
SetStatus("Failed to remove association", false);
|
||||
SetStatus("Failed to remove rule", false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SetStatus($"Error removing association: {ex.Message}", false);
|
||||
SetStatus($"Error removing rule: {ex.Message}", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,7 +412,7 @@ namespace ThreadPilot.ViewModels
|
||||
var success = await _associationService.SaveConfigurationAsync();
|
||||
if (success)
|
||||
{
|
||||
SetStatus("Configuration saved successfully");
|
||||
SetStatus("Configuration saved and active.", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -522,6 +542,43 @@ namespace ThreadPilot.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private void PopulateEditorFromAssociation(ProcessPowerPlanAssociation association)
|
||||
{
|
||||
NewExecutableName = association.ExecutableName ?? string.Empty;
|
||||
NewExecutablePath = association.ExecutablePath ?? string.Empty;
|
||||
MatchByPath = association.MatchByPath;
|
||||
Priority = association.Priority;
|
||||
Description = association.Description ?? string.Empty;
|
||||
SelectedProcessPriority = association.ProcessPriority;
|
||||
|
||||
SelectedPowerPlan = AvailablePowerPlans.FirstOrDefault(p =>
|
||||
string.Equals(p.Guid, association.PowerPlanGuid, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
SelectedCoreMask = AvailableCoreMasks.FirstOrDefault(m =>
|
||||
string.Equals(m.Id, association.CoreMaskId, StringComparison.Ordinal));
|
||||
|
||||
UpdateSelectedExecutableDisplay(
|
||||
NewExecutablePath,
|
||||
string.IsNullOrWhiteSpace(NewExecutableName)
|
||||
? Path.GetFileName(NewExecutablePath)
|
||||
: NewExecutableName);
|
||||
}
|
||||
|
||||
private void ApplyEditorToAssociation(ProcessPowerPlanAssociation association)
|
||||
{
|
||||
association.ExecutableName = NewExecutableName.Trim();
|
||||
association.ExecutablePath = NewExecutablePath.Trim();
|
||||
association.MatchByPath = MatchByPath;
|
||||
association.Priority = Priority;
|
||||
association.Description = Description.Trim();
|
||||
association.ProcessPriority = SelectedProcessPriority;
|
||||
association.PowerPlanGuid = SelectedPowerPlan?.Guid ?? string.Empty;
|
||||
association.PowerPlanName = SelectedPowerPlan?.Name ?? string.Empty;
|
||||
association.CoreMaskId = SelectedCoreMask?.Id;
|
||||
association.CoreMaskName = SelectedCoreMask?.Name;
|
||||
association.UpdatedAt = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
private void OnProcessPowerPlanChanged(object? sender, ProcessPowerPlanChangeEventArgs e)
|
||||
{
|
||||
// Marshal UI updates to the UI thread to prevent cross-thread access exceptions
|
||||
|
||||
Reference in New Issue
Block a user