fix merge issue

This commit is contained in:
Shawn Yuan (from Dev Box)
2025-12-11 16:28:00 +08:00
parent fee146b084
commit 9f99727bf5
5 changed files with 14 additions and 14 deletions

View File

@@ -17,7 +17,7 @@ internal sealed class QuickAccessCoordinator : IQuickAccessCoordinator, IDisposa
{ {
private readonly MainWindow _window; private readonly MainWindow _window;
private readonly QuickAccessLaunchContext _launchContext; private readonly QuickAccessLaunchContext _launchContext;
private readonly SettingsUtils _settingsUtils = new(); private readonly SettingsUtils _settingsUtils = SettingsUtils.Default;
private readonly object _generalSettingsLock = new(); private readonly object _generalSettingsLock = new();
private readonly object _ipcLock = new(); private readonly object _ipcLock = new();
private TwoWayPipeMessageIPCManaged? _ipcManager; private TwoWayPipeMessageIPCManaged? _ipcManager;

View File

@@ -49,7 +49,7 @@ public sealed class AllAppsViewModel : Observable
{ {
_coordinator = coordinator; _coordinator = coordinator;
_dispatcherQueue = DispatcherQueue.GetForCurrentThread(); _dispatcherQueue = DispatcherQueue.GetForCurrentThread();
_settingsUtils = new SettingsUtils(); _settingsUtils = SettingsUtils.Default;
_settingsRepository = SettingsRepository<GeneralSettings>.GetInstance(_settingsUtils); _settingsRepository = SettingsRepository<GeneralSettings>.GetInstance(_settingsUtils);
_generalSettings = _settingsRepository.SettingsConfig; _generalSettings = _settingsRepository.SettingsConfig;
_generalSettings.AddEnabledModuleChangeNotification(ModuleEnabledChangedOnSettingsPage); _generalSettings.AddEnabledModuleChangeNotification(ModuleEnabledChangedOnSettingsPage);

View File

@@ -36,7 +36,7 @@ public sealed class LauncherViewModel : Observable
{ {
_coordinator = coordinator; _coordinator = coordinator;
_dispatcherQueue = DispatcherQueue.GetForCurrentThread(); _dispatcherQueue = DispatcherQueue.GetForCurrentThread();
var settingsUtils = new SettingsUtils(); var settingsUtils = SettingsUtils.Default;
_settingsRepository = SettingsRepository<GeneralSettings>.GetInstance(settingsUtils); _settingsRepository = SettingsRepository<GeneralSettings>.GetInstance(settingsUtils);
_generalSettings = _settingsRepository.SettingsConfig; _generalSettings = _settingsRepository.SettingsConfig;
_generalSettings.AddEnabledModuleChangeNotification(ModuleEnabledChanged); _generalSettings.AddEnabledModuleChangeNotification(ModuleEnabledChanged);
@@ -102,7 +102,7 @@ public sealed class LauncherViewModel : Observable
break; break;
case ModuleType.EnvironmentVariables: case ModuleType.EnvironmentVariables:
{ {
bool launchAdmin = SettingsRepository<EnvironmentVariablesSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.LaunchAdministrator; bool launchAdmin = SettingsRepository<EnvironmentVariablesSettings>.GetInstance(SettingsUtils.Default).SettingsConfig.Properties.LaunchAdministrator;
bool isElevated = _coordinator?.IsRunnerElevated ?? false; bool isElevated = _coordinator?.IsRunnerElevated ?? false;
string eventName = !isElevated && launchAdmin string eventName = !isElevated && launchAdmin
? Constants.ShowEnvironmentVariablesAdminSharedEvent() ? Constants.ShowEnvironmentVariablesAdminSharedEvent()
@@ -124,7 +124,7 @@ public sealed class LauncherViewModel : Observable
break; break;
case ModuleType.Hosts: case ModuleType.Hosts:
{ {
bool launchAdmin = SettingsRepository<HostsSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.LaunchAdministrator; bool launchAdmin = SettingsRepository<HostsSettings>.GetInstance(SettingsUtils.Default).SettingsConfig.Properties.LaunchAdministrator;
bool isElevated = _coordinator?.IsRunnerElevated ?? false; bool isElevated = _coordinator?.IsRunnerElevated ?? false;
string eventName = !isElevated && launchAdmin string eventName = !isElevated && launchAdmin
? Constants.ShowHostsAdminSharedEvent() ? Constants.ShowHostsAdminSharedEvent()
@@ -203,12 +203,12 @@ public sealed class LauncherViewModel : Observable
{ {
return moduleType switch return moduleType switch
{ {
ModuleType.ColorPicker => SettingsRepository<ColorPickerSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.ActivationShortcut.ToString(), ModuleType.ColorPicker => SettingsRepository<ColorPickerSettings>.GetInstance(SettingsUtils.Default).SettingsConfig.Properties.ActivationShortcut.ToString(),
ModuleType.FancyZones => SettingsRepository<FancyZonesSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.FancyzonesEditorHotkey.Value.ToString(), ModuleType.FancyZones => SettingsRepository<FancyZonesSettings>.GetInstance(SettingsUtils.Default).SettingsConfig.Properties.FancyzonesEditorHotkey.Value.ToString(),
ModuleType.PowerLauncher => SettingsRepository<PowerLauncherSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.OpenPowerLauncher.ToString(), ModuleType.PowerLauncher => SettingsRepository<PowerLauncherSettings>.GetInstance(SettingsUtils.Default).SettingsConfig.Properties.OpenPowerLauncher.ToString(),
ModuleType.PowerOCR => SettingsRepository<PowerOcrSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.ActivationShortcut.ToString(), ModuleType.PowerOCR => SettingsRepository<PowerOcrSettings>.GetInstance(SettingsUtils.Default).SettingsConfig.Properties.ActivationShortcut.ToString(),
ModuleType.Workspaces => SettingsRepository<WorkspacesSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.Hotkey.Value.ToString(), ModuleType.Workspaces => SettingsRepository<WorkspacesSettings>.GetInstance(SettingsUtils.Default).SettingsConfig.Properties.Hotkey.Value.ToString(),
ModuleType.MeasureTool => SettingsRepository<MeasureToolSettings>.GetInstance(new SettingsUtils()).SettingsConfig.Properties.ActivationShortcut.ToString(), ModuleType.MeasureTool => SettingsRepository<MeasureToolSettings>.GetInstance(SettingsUtils.Default).SettingsConfig.Properties.ActivationShortcut.ToString(),
ModuleType.ShortcutGuide => GetShortcutGuideToolTip(), ModuleType.ShortcutGuide => GetShortcutGuideToolTip(),
_ => string.Empty, _ => string.Empty,
}; };
@@ -216,7 +216,7 @@ public sealed class LauncherViewModel : Observable
private string GetShortcutGuideToolTip() private string GetShortcutGuideToolTip()
{ {
var shortcutGuideSettings = SettingsRepository<ShortcutGuideSettings>.GetInstance(new SettingsUtils()).SettingsConfig; var shortcutGuideSettings = SettingsRepository<ShortcutGuideSettings>.GetInstance(SettingsUtils.Default).SettingsConfig;
return shortcutGuideSettings.Properties.UseLegacyPressWinKeyBehavior.Value return shortcutGuideSettings.Properties.UseLegacyPressWinKeyBehavior.Value
? "Win" ? "Win"
: shortcutGuideSettings.Properties.OpenShortcutGuide.ToString(); : shortcutGuideSettings.Properties.OpenShortcutGuide.ToString();

View File

@@ -92,7 +92,7 @@ namespace Microsoft.PowerToys.Settings.UI
var outgoing = new OutGoingGeneralSettings(generalSettingsConfig); var outgoing = new OutGoingGeneralSettings(generalSettingsConfig);
// Save settings to file // Save settings to file
new SettingsUtils().SaveSettings(generalSettingsConfig.ToJsonString()); SettingsUtils.Default.SaveSettings(generalSettingsConfig.ToJsonString());
// Send IPC message asynchronously to avoid blocking UI and potential recursive calls // Send IPC message asynchronously to avoid blocking UI and potential recursive calls
Task.Run(() => Task.Run(() =>

View File

@@ -85,7 +85,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
OutGoingGeneralSettings outgoing = new OutGoingGeneralSettings(generalSettingsConfig); OutGoingGeneralSettings outgoing = new OutGoingGeneralSettings(generalSettingsConfig);
// Save settings to file // Save settings to file
new SettingsUtils().SaveSettings(generalSettingsConfig.ToJsonString()); SettingsUtils.Default.SaveSettings(generalSettingsConfig.ToJsonString());
SendConfigMSG(outgoing.ToString()); SendConfigMSG(outgoing.ToString());
SortModuleList(); SortModuleList();