Prepare ThreadPilot 1.7.0 gaming and signing release (#51)
This commit is contained in:
@@ -21,6 +21,8 @@ namespace ThreadPilot.ViewModels
|
||||
|
||||
public partial class SettingsViewModel : BaseViewModel
|
||||
{
|
||||
internal const string DiscordUrl = "https://discord.gg/VYwkCbr4vH";
|
||||
internal const string IssuesUrl = "https://github.com/PrimeBuild-pc/ThreadPilot/issues";
|
||||
private readonly IApplicationSettingsService settingsService;
|
||||
private readonly INotificationService notificationService;
|
||||
private readonly IAutostartService autostartService;
|
||||
@@ -31,8 +33,8 @@ namespace ThreadPilot.ViewModels
|
||||
private readonly ISystemTrayService systemTrayService;
|
||||
private readonly IUpdateService updateService;
|
||||
private readonly IApplicationVersionProvider versionProvider;
|
||||
private readonly ILocalizationService localizationService;
|
||||
private readonly ICpuTopologyProvider? cpuTopologyProvider;
|
||||
private readonly ILocalizationService localizationService;
|
||||
private readonly ICpuTopologyProvider? cpuTopologyProvider;
|
||||
private ApplicationSettingsModel savedSettingsSnapshot;
|
||||
private bool isSyncingFromService = false;
|
||||
private bool? appliedThemePreference;
|
||||
@@ -88,11 +90,11 @@ namespace ThreadPilot.ViewModels
|
||||
[ObservableProperty]
|
||||
private string lastUpdateCheckText = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool isUpdateAvailable = false;
|
||||
|
||||
[ObservableProperty]
|
||||
private string reservedCpuSetsStatus = string.Empty;
|
||||
[ObservableProperty]
|
||||
private bool isUpdateAvailable = false;
|
||||
|
||||
[ObservableProperty]
|
||||
private string reservedCpuSetsStatus = string.Empty;
|
||||
|
||||
public bool CanDownloadAndInstallUpdate => this.IsUpdateAvailable && !this.IsLoading;
|
||||
|
||||
@@ -108,10 +110,10 @@ namespace ThreadPilot.ViewModels
|
||||
ISystemTrayService systemTrayService,
|
||||
IUpdateService updateService,
|
||||
IApplicationVersionProvider versionProvider,
|
||||
ILocalizationService localizationService,
|
||||
IEnhancedLoggingService? enhancedLoggingService = null,
|
||||
IActivityAuditService? activityAuditService = null,
|
||||
ICpuTopologyProvider? cpuTopologyProvider = null)
|
||||
ILocalizationService localizationService,
|
||||
IEnhancedLoggingService? enhancedLoggingService = null,
|
||||
IActivityAuditService? activityAuditService = null,
|
||||
ICpuTopologyProvider? cpuTopologyProvider = null)
|
||||
: base(logger, enhancedLoggingService, activityAuditService)
|
||||
{
|
||||
this.settingsService = settingsService ?? throw new ArgumentNullException(nameof(settingsService));
|
||||
@@ -124,8 +126,8 @@ namespace ThreadPilot.ViewModels
|
||||
this.systemTrayService = systemTrayService ?? throw new ArgumentNullException(nameof(systemTrayService));
|
||||
this.updateService = updateService ?? throw new ArgumentNullException(nameof(updateService));
|
||||
this.versionProvider = versionProvider ?? throw new ArgumentNullException(nameof(versionProvider));
|
||||
this.localizationService = localizationService ?? throw new ArgumentNullException(nameof(localizationService));
|
||||
this.cpuTopologyProvider = cpuTopologyProvider;
|
||||
this.localizationService = localizationService ?? throw new ArgumentNullException(nameof(localizationService));
|
||||
this.cpuTopologyProvider = cpuTopologyProvider;
|
||||
|
||||
this.ApplicationVersion = this.versionProvider.DisplayVersion;
|
||||
|
||||
@@ -133,8 +135,8 @@ namespace ThreadPilot.ViewModels
|
||||
this.settings = (ApplicationSettingsModel)this.settingsService.Settings.Clone();
|
||||
this.savedSettingsSnapshot = (ApplicationSettingsModel)this.settings.Clone();
|
||||
this.appliedThemePreference = this.settings.UseDarkTheme;
|
||||
this.LatestUpdateVersion = this.GetLocalizedString("Settings_UpdateNotChecked", "Not checked");
|
||||
this.ReservedCpuSetsStatus = this.GetLocalizedString("SettingsView_ReservedCpuSetsUnknown", "Reserved CPU Sets: status unavailable.");
|
||||
this.LatestUpdateVersion = this.GetLocalizedString("Settings_UpdateNotChecked", "Not checked");
|
||||
this.ReservedCpuSetsStatus = this.GetLocalizedString("SettingsView_ReservedCpuSetsUnknown", "Reserved CPU Sets: status unavailable.");
|
||||
this.UpdateLastCheckedText();
|
||||
|
||||
// Initialize commands
|
||||
@@ -158,36 +160,42 @@ namespace ThreadPilot.ViewModels
|
||||
this.Logger.LogInformation("Settings ViewModel initialized");
|
||||
}
|
||||
|
||||
public override async Task InitializeAsync()
|
||||
{
|
||||
await this.RefreshSettingsAsync();
|
||||
await this.RefreshPowerPlansAsync();
|
||||
await this.RefreshReservedCpuSetsStatusAsync();
|
||||
}
|
||||
|
||||
private async Task RefreshReservedCpuSetsStatusAsync()
|
||||
{
|
||||
if (this.cpuTopologyProvider == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var topology = await this.cpuTopologyProvider.GetTopologySnapshotAsync();
|
||||
this.ReservedCpuSetsStatus = topology.ReservedLogicalProcessorIndexes.Count == 0
|
||||
? this.GetLocalizedString("SettingsView_ReservedCpuSetsNone", "Reserved CPU Sets: none detected.")
|
||||
: this.GetLocalizedString(
|
||||
"SettingsView_ReservedCpuSetsDetectedFormat",
|
||||
"Reserved CPU Sets detected on logical processors: {0}.",
|
||||
string.Join(", ", topology.ReservedLogicalProcessorIndexes));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.LogDebug(ex, "Could not read reserved CPU Set state");
|
||||
this.ReservedCpuSetsStatus = this.GetLocalizedString("SettingsView_ReservedCpuSetsUnknown", "Reserved CPU Sets: status unavailable.");
|
||||
}
|
||||
}
|
||||
public override async Task InitializeAsync()
|
||||
{
|
||||
await this.RefreshSettingsAsync();
|
||||
await this.RefreshPowerPlansAsync();
|
||||
await this.RefreshReservedCpuSetsStatusAsync();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenDiscord() => this.OpenExternalLink(DiscordUrl);
|
||||
|
||||
[RelayCommand]
|
||||
private void ReportIssue() => this.OpenExternalLink(IssuesUrl);
|
||||
|
||||
private async Task RefreshReservedCpuSetsStatusAsync()
|
||||
{
|
||||
if (this.cpuTopologyProvider == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var topology = await this.cpuTopologyProvider.GetTopologySnapshotAsync();
|
||||
this.ReservedCpuSetsStatus = topology.ReservedLogicalProcessorIndexes.Count == 0
|
||||
? this.GetLocalizedString("SettingsView_ReservedCpuSetsNone", "Reserved CPU Sets: none detected.")
|
||||
: this.GetLocalizedString(
|
||||
"SettingsView_ReservedCpuSetsDetectedFormat",
|
||||
"Reserved CPU Sets detected on logical processors: {0}.",
|
||||
string.Join(", ", topology.ReservedLogicalProcessorIndexes));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.Logger.LogDebug(ex, "Could not read reserved CPU Set state");
|
||||
this.ReservedCpuSetsStatus = this.GetLocalizedString("SettingsView_ReservedCpuSetsUnknown", "Reserved CPU Sets: status unavailable.");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSettingsPropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user