Refactor SettingsUtils and update project ID

Refactored `SettingsUtils` initialization across multiple files
(`App.xaml.cs`, `MainWindow.xaml.cs`, `MainViewModel.cs`) to use
`SettingsUtils.Default` instead of creating new instances. This
improves consistency, reduces redundancy, and promotes better
resource management.

Updated the project ID for `PowerDisplayModuleInterface.vcxproj`
in `PowerToys.slnx` to reflect a configuration or structural
change in the project setup.
This commit is contained in:
Yu Leng
2025-12-08 13:37:06 +08:00
parent 430a41875e
commit 0655497762
4 changed files with 4 additions and 4 deletions

View File

@@ -655,7 +655,7 @@
<Platform Solution="*|ARM64" Project="ARM64" />
<Platform Solution="*|x64" Project="x64" />
</Project>
<Project Path="src/modules/powerdisplay/PowerDisplayModuleInterface/PowerDisplayModuleInterface.vcxproj" Id="a1b2c3d4-e5f6-7890-abcd-ef1234567890" />
<Project Path="src/modules/powerdisplay/PowerDisplayModuleInterface/PowerDisplayModuleInterface.vcxproj" Id="d1234567-8901-2345-6789-abcdef012345" />
</Folder>
<Folder Name="/modules/PowerDisplay/Tests/">
<Project Path="src/modules/powerdisplay/PowerDisplay.Lib.UnitTests/PowerDisplay.Lib.UnitTests.csproj">

View File

@@ -32,7 +32,7 @@ namespace PowerDisplay
/// </summary>
private const string ProcessReadyEventName = "Local\\PowerToys_PowerDisplay_Ready";
private readonly ISettingsUtils _settingsUtils = new SettingsUtils();
private readonly ISettingsUtils _settingsUtils = SettingsUtils.Default;
private Window? _mainWindow;
private int _powerToysRunnerPid;
private TrayIconService? _trayIconService;

View File

@@ -32,7 +32,7 @@ namespace PowerDisplay
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicMethods)]
public sealed partial class MainWindow : WindowEx, IDisposable
{
private readonly ISettingsUtils _settingsUtils = new SettingsUtils();
private readonly ISettingsUtils _settingsUtils = SettingsUtils.Default;
private MainViewModel? _viewModel;
private AppWindow? _appWindow;
private bool _isExiting;

View File

@@ -62,7 +62,7 @@ public partial class MainViewModel : INotifyPropertyChanged, IDisposable
_isScanning = true;
// Initialize settings utils
_settingsUtils = new SettingsUtils();
_settingsUtils = SettingsUtils.Default;
_stateManager = new MonitorStateManager();
// Initialize the monitor manager