Remove ISettingsUtils and ISettingsPath interfaces (#44331)

<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request

This PR removes the ISettingsUtils and ISettingsPath interfaces to
reduce some complexity. They only existed so the classes can be used
with moq. But this is also possible by using virtual methods which is
cleaner.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [x] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx
This commit is contained in:
Noraa Junker
2025-12-19 03:30:01 +01:00
committed by GitHub
parent 9aab0f3893
commit 7cd201d355
58 changed files with 112 additions and 154 deletions

View File

@@ -31,7 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
Name = ModuleName;
}
public virtual void Save(ISettingsUtils settingsUtils)
public virtual void Save(SettingsUtils settingsUtils)
{
// Save settings to file
var options = _serializerOptions;

View File

@@ -25,7 +25,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
Name = ModuleName;
}
public virtual void Save(ISettingsUtils settingsUtils)
public virtual void Save(SettingsUtils settingsUtils)
{
// Save settings to file
ArgumentNullException.ThrowIfNull(settingsUtils);

View File

@@ -33,7 +33,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
WriteIndented = true,
};
public virtual void Save(ISettingsUtils settingsUtils)
public virtual void Save(SettingsUtils settingsUtils)
{
// Save settings to file
var options = _serializerOptions;

View File

@@ -28,7 +28,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
Name = ModuleName;
}
public virtual void Save(ISettingsUtils settingsUtils)
public virtual void Save(SettingsUtils settingsUtils)
{
// Save settings to file
var options = _serializerOptions;

View File

@@ -29,7 +29,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
Name = ModuleName;
}
public virtual void Save(ISettingsUtils settingsUtils)
public virtual void Save(SettingsUtils settingsUtils)
{
// Save settings to file
var options = _serializerOptions;

View File

@@ -29,7 +29,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
Name = ModuleName;
}
public virtual void Save(ISettingsUtils settingsUtils)
public virtual void Save(SettingsUtils settingsUtils)
{
// Save settings to file
var options = _serializerOptions;

View File

@@ -1,17 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.PowerToys.Settings.UI.Library
{
public interface ISettingsPath
{
bool SettingsFolderExists(string powertoy);
void CreateSettingsFolder(string powertoy);
void DeleteSettings(string powertoy = "");
string GetSettingsPath(string powertoy, string fileName);
}
}

View File

@@ -1,33 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
namespace Microsoft.PowerToys.Settings.UI.Library
{
public interface ISettingsUtils
{
public const string DefaultFileName = "settings.json";
T GetSettings<T>(string powertoy = "", string fileName = DefaultFileName)
where T : ISettingsConfig, new();
T GetSettingsOrDefault<T>(string powertoy = "", string fileName = DefaultFileName)
where T : ISettingsConfig, new();
void SaveSettings(string jsonSettings, string powertoy = "", string fileName = DefaultFileName);
bool SettingsExists(string powertoy = "", string fileName = DefaultFileName);
void DeleteSettings(string powertoy = "");
string GetSettingsFilePath(string powertoy = "", string fileName = DefaultFileName);
T GetSettingsOrDefault<T, T2>(string powertoy = "", string fileName = DefaultFileName, Func<object, object> settingsUpgrader = null)
where T : ISettingsConfig, new()
where T2 : ISettingsConfig, new();
}
}

View File

@@ -33,7 +33,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
Version = "1.1";
}
public void Save(ISettingsUtils settingsUtils)
public void Save(SettingsUtils settingsUtils)
{
// Save settings to file
var options = _serializerOptions;

View File

@@ -125,7 +125,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
#pragma warning restore CS0618
}
public virtual void Save(ISettingsUtils settingsUtils)
public virtual void Save(SettingsUtils settingsUtils)
{
// Save settings to file
var options = _serializerOptions;

View File

@@ -67,7 +67,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
return false;
}
public virtual void Save(ISettingsUtils settingsUtils)
public virtual void Save(SettingsUtils settingsUtils)
{
// Save settings to file
var options = _serializerOptions;

View File

@@ -35,7 +35,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
Name = ModuleName;
}
public virtual void Save(ISettingsUtils settingsUtils)
public virtual void Save(SettingsUtils settingsUtils)
{
// Save settings to file
var options = _serializerOptions;

View File

@@ -31,7 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
Name = ModuleName;
}
public virtual void Save(ISettingsUtils settingsUtils)
public virtual void Save(SettingsUtils settingsUtils)
{
// Save settings to file
var options = _serializerOptions;

View File

@@ -9,7 +9,7 @@ using Microsoft.PowerToys.Settings.UI.Library.Utilities;
namespace Microsoft.PowerToys.Settings.UI.Library
{
public class SettingPath : ISettingsPath
public class SettingPath
{
private const string DefaultFileName = "settings.json";
@@ -23,6 +23,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library
_path = path ?? throw new ArgumentNullException(nameof(path));
}
public SettingPath()
: this(new FileSystem().Directory, new FileSystem().Path)
{
}
public bool SettingsFolderExists(string powertoy)
{
return _directory.Exists(System.IO.Path.Combine(Helper.LocalApplicationDataFolder(), $"Microsoft\\PowerToys\\{powertoy}"));

View File

@@ -17,10 +17,10 @@ namespace Microsoft.PowerToys.Settings.UI.Services
/// </summary>
public class SettingsFactory
{
private readonly ISettingsUtils _settingsUtils;
private readonly SettingsUtils _settingsUtils;
private readonly Dictionary<string, Type> _settingsTypes;
public SettingsFactory(ISettingsUtils settingsUtils)
public SettingsFactory(SettingsUtils settingsUtils)
{
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
_settingsTypes = DiscoverSettingsTypes();
@@ -100,7 +100,7 @@ namespace Microsoft.PowerToys.Settings.UI.Services
try
{
// Create a generic method call to _settingsUtils.GetSettingsOrDefault<T>(moduleKey)
var getSettingsMethod = typeof(ISettingsUtils).GetMethod("GetSettingsOrDefault", new[] { typeof(string), typeof(string) });
var getSettingsMethod = typeof(SettingsUtils).GetMethod("GetSettingsOrDefault", new[] { typeof(string), typeof(string) });
var genericMethod = getSettingsMethod?.MakeGenericMethod(settingsType);
// Call GetSettingsOrDefault<T>(moduleKey) to get fresh settings from file

View File

@@ -16,7 +16,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
private static readonly Lock _SettingsRepoLock = new Lock();
private static ISettingsUtils _settingsUtils;
private static SettingsUtils _settingsUtils;
private static SettingsRepository<T> settingsRepository;
@@ -25,7 +25,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
// Suppressing the warning as this is a singleton class and this method is
// necessarily static
#pragma warning disable CA1000 // Do not declare static members on generic types
public static SettingsRepository<T> GetInstance(ISettingsUtils settingsUtils)
public static SettingsRepository<T> GetInstance(SettingsUtils settingsUtils)
#pragma warning restore CA1000 // Do not declare static members on generic types
{
// To ensure that only one instance of Settings Repository is created in a multi-threaded environment.

View File

@@ -7,6 +7,7 @@
using System;
using System.IO;
using System.IO.Abstractions;
using System.Runtime.CompilerServices;
using System.Text.Json;
using ManagedCommon;
@@ -14,12 +15,13 @@ using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
namespace Microsoft.PowerToys.Settings.UI.Library
{
public class SettingsUtils : ISettingsUtils
// Some functions are marked as virtual to allow mocking in unit tests.
public class SettingsUtils
{
public const string DefaultFileName = "settings.json";
private const string DefaultModuleName = "";
private readonly IFile _file;
private readonly ISettingsPath _settingsPath;
private readonly SettingPath _settingsPath;
private readonly JsonSerializerOptions _serializerOptions;
/// <summary>
@@ -39,7 +41,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
}
public SettingsUtils(IFile file, ISettingsPath settingPath, JsonSerializerOptions? serializerOptions = null)
public SettingsUtils(IFile file, SettingPath settingPath, JsonSerializerOptions? serializerOptions = null)
{
_file = file ?? throw new ArgumentNullException(nameof(file));
_settingsPath = settingPath;
@@ -62,7 +64,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
_settingsPath.DeleteSettings(powertoy);
}
public T GetSettings<T>(string powertoy = DefaultModuleName, string fileName = DefaultFileName)
public virtual T GetSettings<T>(string powertoy = DefaultModuleName, string fileName = DefaultFileName)
where T : ISettingsConfig, new()
{
if (!SettingsExists(powertoy, fileName))
@@ -87,7 +89,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
/// This function creates a file in the powertoy folder if it does not exist and returns an object with default properties.
/// </summary>
/// <returns>Deserialized json settings object.</returns>
public T GetSettingsOrDefault<T>(string powertoy = DefaultModuleName, string fileName = DefaultFileName)
public virtual T GetSettingsOrDefault<T>(string powertoy = DefaultModuleName, string fileName = DefaultFileName)
where T : ISettingsConfig, new()
{
try
@@ -118,7 +120,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
/// This function creates a file in the powertoy folder if it does not exist and returns an object with default properties.
/// </summary>
/// <returns>Deserialized json settings object.</returns>
public T GetSettingsOrDefault<T, T2>(string powertoy = DefaultModuleName, string fileName = DefaultFileName, Func<object, object>? settingsUpgrader = null)
public virtual T GetSettingsOrDefault<T, T2>(string powertoy = DefaultModuleName, string fileName = DefaultFileName, Func<object, object>? settingsUpgrader = null)
where T : ISettingsConfig, new()
where T2 : ISettingsConfig, new()
{
@@ -203,7 +205,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
}
// Save settings to a json file.
public void SaveSettings(string jsonSettings, string powertoy = DefaultModuleName, string fileName = DefaultFileName)
public virtual void SaveSettings(string jsonSettings, string powertoy = DefaultModuleName, string fileName = DefaultFileName)
{
try
{

View File

@@ -18,13 +18,13 @@ public class CommandLineUtils
return settingsLibraryAssembly.GetType(typeof(CommandLineUtils).Namespace + "." + settingsClassName);
}
public static ISettingsConfig GetSettingsConfigFor(string moduleName, ISettingsUtils settingsUtils, Assembly settingsLibraryAssembly)
public static ISettingsConfig GetSettingsConfigFor(string moduleName, SettingsUtils settingsUtils, Assembly settingsLibraryAssembly)
{
return GetSettingsConfigFor(GetSettingsConfigType(moduleName, settingsLibraryAssembly), settingsUtils);
}
/// Executes SettingsRepository<moduleSettingsType>.GetInstance(settingsUtils).SettingsConfig
public static ISettingsConfig GetSettingsConfigFor(Type moduleSettingsType, ISettingsUtils settingsUtils)
public static ISettingsConfig GetSettingsConfigFor(Type moduleSettingsType, SettingsUtils settingsUtils)
{
var genericSettingsRepositoryType = typeof(SettingsRepository<>);
var moduleSettingsRepositoryType = genericSettingsRepositoryType.MakeGenericType(moduleSettingsType);

View File

@@ -244,7 +244,7 @@ public sealed class SetAdditionalSettingsCommandLineCommand
}
}
public static void Execute(string moduleName, JsonDocument settings, ISettingsUtils settingsUtils)
public static void Execute(string moduleName, JsonDocument settings, SettingsUtils settingsUtils)
{
Assembly settingsLibraryAssembly = CommandLineUtils.GetSettingsAssembly();

View File

@@ -25,7 +25,7 @@ public sealed class SetSettingCommandLineCommand
return (parts[0], parts[1]);
}
public static void Execute(string settingName, string settingValue, ISettingsUtils settingsUtils)
public static void Execute(string settingName, string settingValue, SettingsUtils settingsUtils)
{
Assembly settingsLibraryAssembly = CommandLineUtils.GetSettingsAssembly();

View File

@@ -56,7 +56,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
return hotkeyAccessors.ToArray();
}
public virtual void Save(ISettingsUtils settingsUtils)
public virtual void Save(SettingsUtils settingsUtils)
{
// Save settings to file
var options = _serializerOptions;

View File

@@ -27,10 +27,10 @@ namespace Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility
internal sealed class MockSettingsRepository<T> : ISettingsRepository<T>
where T : ISettingsConfig, new()
{
private readonly ISettingsUtils _settingsUtils;
private readonly SettingsUtils _settingsUtils;
private T _settingsConfig;
public MockSettingsRepository(ISettingsUtils settingsUtils)
public MockSettingsRepository(SettingsUtils settingsUtils)
{
_settingsUtils = settingsUtils;
}

View File

@@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.IO.Abstractions;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
using Moq;
@@ -11,10 +12,10 @@ namespace Microsoft.PowerToys.Settings.UI.UnitTests.Mocks
internal static class ISettingsUtilsMocks
{
// Stubs out empty values for imageresizersettings and general settings as needed by the imageresizer view model
internal static Mock<ISettingsUtils> GetStubSettingsUtils<T>()
internal static Mock<SettingsUtils> GetStubSettingsUtils<T>()
where T : ISettingsConfig, new()
{
var settingsUtils = new Mock<ISettingsUtils>();
var settingsUtils = new Mock<SettingsUtils>(new FileSystem(), null);
settingsUtils
.Setup(x => x.GetSettingsOrDefault<T>(It.IsAny<string>(), It.IsAny<string>()))
.Returns(new T());

View File

@@ -14,7 +14,7 @@ namespace CommonLibTest
[TestClass]
public class SettingsRepositoryTest
{
private static Task<SettingsRepository<GeneralSettings>> GetSettingsRepository(ISettingsUtils settingsUtils)
private static Task<SettingsRepository<GeneralSettings>> GetSettingsRepository(SettingsUtils settingsUtils)
{
return Task.Run(() =>
{

View File

@@ -27,7 +27,7 @@ namespace ViewModelTests
{
// Arrange
var mockIOProvider = BackCompatTestProperties.GetModuleIOProvider(version, ColorPickerSettings.ModuleName, fileName);
var settingPathMock = new Mock<ISettingsPath>();
var settingPathMock = new Mock<SettingPath>();
var mockSettingsUtils = new SettingsUtils(mockIOProvider.Object, settingPathMock.Object);
ColorPickerSettings originalSettings = mockSettingsUtils.GetSettingsOrDefault<ColorPickerSettings>(ColorPickerSettings.ModuleName);

View File

@@ -32,7 +32,7 @@ namespace ViewModelTests
[DataRow("v0.22.0", "settings.json")]
public void OriginalFilesModificationTest(string version, string fileName)
{
var settingPathMock = new Mock<ISettingsPath>();
var settingPathMock = new Mock<SettingPath>();
var fileMock = BackCompatTestProperties.GetModuleIOProvider(version, FancyZonesSettings.ModuleName, fileName);
var mockSettingsUtils = new SettingsUtils(fileMock.Object, settingPathMock.Object);
@@ -89,9 +89,9 @@ namespace ViewModelTests
return 0;
}
private Mock<ISettingsUtils> mockGeneralSettingsUtils;
private Mock<SettingsUtils> mockGeneralSettingsUtils;
private Mock<ISettingsUtils> mockFancyZonesSettingsUtils;
private Mock<SettingsUtils> mockFancyZonesSettingsUtils;
private Func<string, int> sendMockIPCConfigMSG = msg => { return 0; };

View File

@@ -20,7 +20,7 @@ namespace ViewModelTests
{
public const string GeneralSettingsFileName = "Test\\GeneralSettings";
private Mock<ISettingsUtils> mockGeneralSettingsUtils;
private Mock<SettingsUtils> mockGeneralSettingsUtils;
[TestInitialize]
public void SetUpStubSettingUtils()
@@ -36,7 +36,7 @@ namespace ViewModelTests
[DataRow("v0.22.0")]
public void OriginalFilesModificationTest(string version)
{
var settingPathMock = new Mock<ISettingsPath>();
var settingPathMock = new Mock<SettingPath>();
var fileMock = BackCompatTestProperties.GetGeneralSettingsIOProvider(version);
var mockGeneralSettingsUtils = new SettingsUtils(fileMock.Object, settingPathMock.Object);

View File

@@ -19,9 +19,9 @@ namespace ViewModelTests
[TestClass]
public class ImageResizer
{
private Mock<ISettingsUtils> _mockGeneralSettingsUtils;
private Mock<SettingsUtils> _mockGeneralSettingsUtils;
private Mock<ISettingsUtils> _mockImgResizerSettingsUtils;
private Mock<SettingsUtils> _mockImgResizerSettingsUtils;
[TestInitialize]
public void SetUpStubSettingUtils()
@@ -41,7 +41,7 @@ namespace ViewModelTests
[DataRow("v0.22.0", "settings.json")]
public void OriginalFilesModificationTest(string version, string fileName)
{
var settingPathMock = new Mock<ISettingsPath>();
var settingPathMock = new Mock<SettingPath>();
var fileMock = BackCompatTestProperties.GetModuleIOProvider(version, ImageResizerSettings.ModuleName, fileName);
var mockSettingsUtils = new SettingsUtils(fileMock.Object, settingPathMock.Object);

View File

@@ -46,7 +46,7 @@ namespace ViewModelTests
mockSettings = new PowerLauncherSettings();
sendCallbackMock = new SendCallbackMock();
var settingPathMock = new Mock<ISettingsPath>();
var settingPathMock = new Mock<SettingPath>();
var mockGeneralIOProvider = BackCompatTestProperties.GetGeneralSettingsIOProvider("v0.22.0");
var mockGeneralSettingsUtils = new SettingsUtils(mockGeneralIOProvider.Object, settingPathMock.Object);
mockGeneralSettingsRepository = new BackCompatTestProperties.MockSettingsRepository<GeneralSettings>(mockGeneralSettingsUtils);
@@ -81,7 +81,7 @@ namespace ViewModelTests
[DataRow("v0.22.0", "settings.json")]
public void OriginalFilesModificationTest(string version, string fileName)
{
var settingPathMock = new Mock<ISettingsPath>();
var settingPathMock = new Mock<SettingPath>();
var mockIOProvider = BackCompatTestProperties.GetModuleIOProvider(version, PowerLauncherSettings.ModuleName, fileName);
var mockSettingsUtils = new SettingsUtils(mockIOProvider.Object, settingPathMock.Object);

View File

@@ -17,9 +17,9 @@ namespace ViewModelTests
[TestClass]
public class PowerPreview
{
private Mock<ISettingsUtils> mockPowerPreviewSettingsUtils;
private Mock<SettingsUtils> mockPowerPreviewSettingsUtils;
private Mock<ISettingsUtils> mockGeneralSettingsUtils;
private Mock<SettingsUtils> mockGeneralSettingsUtils;
[TestInitialize]
public void SetUpStubSettingUtils()
@@ -39,7 +39,7 @@ namespace ViewModelTests
[DataRow("v0.22.0", "settings.json")]
public void OriginalFilesModificationTest(string version, string fileName)
{
var settingPathMock = new Mock<ISettingsPath>();
var settingPathMock = new Mock<SettingPath>();
var fileMock = BackCompatTestProperties.GetModuleIOProvider(version, PowerPreviewSettings.ModuleName, fileName);
var mockSettingsUtils = new SettingsUtils(fileMock.Object, settingPathMock.Object);

View File

@@ -19,9 +19,9 @@ namespace ViewModelTests
{
public const string GeneralSettingsFileName = "Test\\PowerRename";
private Mock<ISettingsUtils> mockGeneralSettingsUtils;
private Mock<SettingsUtils> mockGeneralSettingsUtils;
private Mock<ISettingsUtils> mockPowerRenamePropertiesUtils;
private Mock<SettingsUtils> mockPowerRenamePropertiesUtils;
[TestInitialize]
public void SetUpStubSettingUtils()
@@ -40,7 +40,7 @@ namespace ViewModelTests
[DataRow("v0.22.0", "power-rename-settings.json")]
public void OriginalFilesModificationTest(string version, string fileName)
{
var settingPathMock = new Mock<ISettingsPath>();
var settingPathMock = new Mock<SettingPath>();
var mockIOProvider = BackCompatTestProperties.GetModuleIOProvider(version, PowerRenameSettings.ModuleName, fileName);
var mockSettingsUtils = new SettingsUtils(mockIOProvider.Object, settingPathMock.Object);

View File

@@ -31,7 +31,7 @@ namespace ViewModelTests
[DataRow("v0.22.0", "settings.json")]
public void OriginalFilesModificationTest(string version, string fileName)
{
var settingPathMock = new Mock<ISettingsPath>();
var settingPathMock = new Mock<SettingPath>();
var mockIOProvider = BackCompatTestProperties.GetModuleIOProvider(version, ShortcutGuideSettings.ModuleName, fileName);
var mockSettingsUtils = new SettingsUtils(mockIOProvider.Object, settingPathMock.Object);
ShortcutGuideSettings originalSettings = mockSettingsUtils.GetSettingsOrDefault<ShortcutGuideSettings>(ShortcutGuideSettings.ModuleName);
@@ -56,9 +56,9 @@ namespace ViewModelTests
BackCompatTestProperties.VerifyGeneralSettingsIOProviderWasRead(mockGeneralIOProvider, expectedCallCount);
}
private Mock<ISettingsUtils> mockGeneralSettingsUtils;
private Mock<SettingsUtils> mockGeneralSettingsUtils;
private Mock<ISettingsUtils> mockShortcutGuideSettingsUtils;
private Mock<SettingsUtils> mockShortcutGuideSettingsUtils;
[TestInitialize]
public void SetUpStubSettingUtils()
@@ -92,7 +92,7 @@ namespace ViewModelTests
public void ThemeIndexShouldSetThemeToDarkWhenSuccessful()
{
// Arrange
var settingsUtilsMock = new Mock<ISettingsUtils>();
var settingsUtilsMock = new Mock<SettingsUtils>(new FileSystem(), null);
ShortcutGuideViewModel viewModel = new ShortcutGuideViewModel(settingsUtilsMock.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SettingsRepository<ShortcutGuideSettings>.GetInstance(mockShortcutGuideSettingsUtils.Object), msg => { return 0; }, ShortCutGuideTestFolderName);
// Initialize shortcut guide settings theme to 'system' to be in sync with shortcut_guide.h.
@@ -110,7 +110,7 @@ namespace ViewModelTests
public void OverlayOpacityShouldSeOverlayOpacityToOneHundredWhenSuccessful()
{
// Arrange
var settingsUtilsMock = new Mock<ISettingsUtils>();
var settingsUtilsMock = new Mock<SettingsUtils>(new FileSystem(), null);
ShortcutGuideViewModel viewModel = new ShortcutGuideViewModel(settingsUtilsMock.Object, SettingsRepository<GeneralSettings>.GetInstance(mockGeneralSettingsUtils.Object), SettingsRepository<ShortcutGuideSettings>.GetInstance(mockShortcutGuideSettingsUtils.Object), msg => { return 0; }, ShortCutGuideTestFolderName);
Assert.AreEqual(90, viewModel.OverlayOpacity);

View File

@@ -18,7 +18,7 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
public static class HotkeyConflictIgnoreHelper
{
private static readonly ISettingsRepository<GeneralSettings> _generalSettingsRepository;
private static readonly ISettingsUtils _settingsUtils;
private static readonly SettingsUtils _settingsUtils;
static HotkeyConflictIgnoreHelper()
{

View File

@@ -357,7 +357,7 @@ namespace Microsoft.PowerToys.Settings.UI
return 0;
}
private static ISettingsUtils settingsUtils = SettingsUtils.Default;
private static SettingsUtils settingsUtils = SettingsUtils.Default;
private static ThemeService themeService = new ThemeService(SettingsRepository<GeneralSettings>.GetInstance(settingsUtils));
public static ThemeService ThemeService => themeService;

View File

@@ -51,7 +51,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
public ObservableCollection<OobePowerToysModule> Modules { get; }
private static ISettingsUtils settingsUtils = SettingsUtils.Default;
private static SettingsUtils settingsUtils = SettingsUtils.Default;
/* NOTE: Experimentation for OOBE is currently turned off on server side. Keeping this code in a comment to allow future experiments.
private bool ExperimentationToggleSwitchEnabled { get; set; } = true;

View File

@@ -38,7 +38,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private GeneralSettings GeneralSettingsConfig { get; set; }
private readonly ISettingsUtils _settingsUtils;
private readonly SettingsUtils _settingsUtils;
private readonly AdvancedPasteSettings _advancedPasteSettings;
private readonly AdvancedPasteAdditionalActions _additionalActions;
@@ -66,7 +66,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
};
public AdvancedPasteViewModel(
ISettingsUtils settingsUtils,
SettingsUtils settingsUtils,
ISettingsRepository<GeneralSettings> settingsRepository,
ISettingsRepository<AdvancedPasteSettings> advancedPasteSettingsRepository,
Func<string, int> ipcMSGCallBackFunc)

View File

@@ -22,7 +22,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
protected override string ModuleName => AlwaysOnTopSettings.ModuleName;
private ISettingsUtils SettingsUtils { get; set; }
private SettingsUtils SettingsUtils { get; set; }
private GeneralSettings GeneralSettingsConfig { get; set; }
@@ -30,7 +30,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private Func<string, int> SendConfigMSG { get; }
public AlwaysOnTopViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<AlwaysOnTopSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
public AlwaysOnTopViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<AlwaysOnTopSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
{
ArgumentNullException.ThrowIfNull(settingsUtils);

View File

@@ -38,7 +38,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private Func<string, int> SendConfigMSG { get; }
public CmdPalViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, DispatcherQueue uiDispatcherQueue)
public CmdPalViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, DispatcherQueue uiDispatcherQueue)
{
ArgumentNullException.ThrowIfNull(settingsUtils);

View File

@@ -31,7 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private GeneralSettings GeneralSettingsConfig { get; set; }
private readonly ISettingsUtils _settingsUtils;
private readonly SettingsUtils _settingsUtils;
private readonly System.Threading.Lock _delayedActionLock = new System.Threading.Lock();
private readonly ColorPickerSettings _colorPickerSettings;
@@ -47,7 +47,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private Dictionary<string, string> _colorFormatsPreview;
public ColorPickerViewModel(
ISettingsUtils settingsUtils,
SettingsUtils settingsUtils,
ISettingsRepository<GeneralSettings> settingsRepository,
ISettingsRepository<ColorPickerSettings> colorPickerSettingsRepository,
Func<string, int> ipcMSGCallBackFunc)

View File

@@ -21,7 +21,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
protected override string ModuleName => CropAndLockSettings.ModuleName;
private ISettingsUtils SettingsUtils { get; set; }
private SettingsUtils SettingsUtils { get; set; }
private GeneralSettings GeneralSettingsConfig { get; set; }
@@ -29,7 +29,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private Func<string, int> SendConfigMSG { get; }
public CropAndLockViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<CropAndLockSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
public CropAndLockViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<CropAndLockSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
{
ArgumentNullException.ThrowIfNull(settingsUtils);

View File

@@ -23,7 +23,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private bool _enabledStateIsGPOConfigured;
private bool _isEnabled;
private ISettingsUtils SettingsUtils { get; set; }
private SettingsUtils SettingsUtils { get; set; }
private GeneralSettings GeneralSettingsConfig { get; set; }
@@ -79,7 +79,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public EnvironmentVariablesViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<EnvironmentVariablesSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, bool isElevated)
public EnvironmentVariablesViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<EnvironmentVariablesSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, bool isElevated)
{
SettingsUtils = settingsUtils;
GeneralSettingsConfig = settingsRepository.SettingsConfig;

View File

@@ -19,7 +19,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
protected override string ModuleName => FancyZonesSettings.ModuleName;
private ISettingsUtils SettingsUtils { get; set; }
private SettingsUtils SettingsUtils { get; set; }
private GeneralSettings GeneralSettingsConfig { get; set; }
@@ -46,7 +46,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
Positional = 2,
}
public FancyZonesViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<FancyZonesSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
public FancyZonesViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<FancyZonesSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
{
ArgumentNullException.ThrowIfNull(settingsUtils);

View File

@@ -18,7 +18,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
private GeneralSettings GeneralSettingsConfig { get; set; }
private readonly ISettingsUtils _settingsUtils;
private readonly SettingsUtils _settingsUtils;
private FileLocksmithSettings Settings { get; set; }
@@ -26,7 +26,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private string _settingsConfigFileFolder = string.Empty;
public FileLocksmithViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
public FileLocksmithViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
{
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));

View File

@@ -23,7 +23,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private bool _enabledStateIsGPOConfigured;
private bool _isEnabled;
private ISettingsUtils SettingsUtils { get; set; }
private SettingsUtils SettingsUtils { get; set; }
private GeneralSettings GeneralSettingsConfig { get; set; }
@@ -214,7 +214,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
public int MinimumBackupsCount => DeleteBackupsMode == 1 ? 1 : 0;
public HostsViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<HostsSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, bool isElevated)
public HostsViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<HostsSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, bool isElevated)
{
SettingsUtils = settingsUtils;
GeneralSettingsConfig = settingsRepository.SettingsConfig;

View File

@@ -45,7 +45,7 @@ public partial class ImageResizerViewModel : Observable
private GeneralSettings GeneralSettingsConfig { get; set; }
private readonly ISettingsUtils _settingsUtils;
private readonly SettingsUtils _settingsUtils;
private ImageResizerSettings Settings { get; set; }
@@ -53,7 +53,7 @@ public partial class ImageResizerViewModel : Observable
private Func<string, int> SendConfigMSG { get; }
public ImageResizerViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, Func<string, string> resourceLoader)
public ImageResizerViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, Func<string, string> resourceLoader)
{
_isInitializing = true;

View File

@@ -27,7 +27,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
private GeneralSettings GeneralSettingsConfig { get; set; }
private readonly ISettingsUtils _settingsUtils;
private readonly SettingsUtils _settingsUtils;
private const string PowerToyName = KeyboardManagerSettings.ModuleName;
private const string JsonFileType = ".json";
@@ -60,7 +60,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private Func<List<KeysDataModel>, int> FilterRemapKeysList { get; }
public KeyboardManagerViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, Func<List<KeysDataModel>, int> filterRemapKeysList)
public KeyboardManagerViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, Func<List<KeysDataModel>, int> filterRemapKeysList)
{
ArgumentNullException.ThrowIfNull(settingsRepository);

View File

@@ -20,7 +20,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
protected override string ModuleName => MeasureToolSettings.ModuleName;
private ISettingsUtils SettingsUtils { get; set; }
private SettingsUtils SettingsUtils { get; set; }
private GeneralSettings GeneralSettingsConfig { get; set; }
@@ -30,7 +30,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private MeasureToolSettings Settings { get; set; }
public MeasureToolViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<MeasureToolSettings> measureToolSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
public MeasureToolViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<MeasureToolSettings> measureToolSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
{
SettingsUtils = settingsUtils;

View File

@@ -19,7 +19,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
protected override string ModuleName => "MouseUtils";
private ISettingsUtils SettingsUtils { get; set; }
private SettingsUtils SettingsUtils { get; set; }
private GeneralSettings GeneralSettingsConfig { get; set; }
@@ -31,7 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private CursorWrapSettings CursorWrapSettingsConfig { get; set; }
public MouseUtilsViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<FindMyMouseSettings> findMyMouseSettingsRepository, ISettingsRepository<MouseHighlighterSettings> mouseHighlighterSettingsRepository, ISettingsRepository<MouseJumpSettings> mouseJumpSettingsRepository, ISettingsRepository<MousePointerCrosshairsSettings> mousePointerCrosshairsSettingsRepository, ISettingsRepository<CursorWrapSettings> cursorWrapSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
public MouseUtilsViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<FindMyMouseSettings> findMyMouseSettingsRepository, ISettingsRepository<MouseHighlighterSettings> mouseHighlighterSettingsRepository, ISettingsRepository<MouseJumpSettings> mouseJumpSettingsRepository, ISettingsRepository<MousePointerCrosshairsSettings> mousePointerCrosshairsSettingsRepository, ISettingsRepository<CursorWrapSettings> cursorWrapSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
{
SettingsUtils = settingsUtils;

View File

@@ -187,7 +187,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
private ISettingsUtils SettingsUtils { get; set; }
private SettingsUtils SettingsUtils { get; set; }
private GeneralSettings GeneralSettingsConfig { get; set; }
@@ -425,7 +425,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private DispatcherQueue _uiDispatcherQueue;
public MouseWithoutBordersViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, DispatcherQueue uiDispatcherQueue)
public MouseWithoutBordersViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, DispatcherQueue uiDispatcherQueue)
{
SettingsUtils = settingsUtils;

View File

@@ -26,13 +26,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
private GeneralSettings GeneralSettingsConfig { get; set; }
private readonly ISettingsUtils _settingsUtils;
private readonly SettingsUtils _settingsUtils;
private NewPlusSettings Settings { get; set; }
private const string ModuleName = NewPlusSettings.ModuleName;
public NewPlusViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc)
public NewPlusViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc)
{
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));
@@ -228,7 +228,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private Func<string, int> SendConfigMSG { get; }
public static NewPlusSettings LoadSettings(ISettingsUtils settingsUtils)
public static NewPlusSettings LoadSettings(SettingsUtils settingsUtils)
{
NewPlusSettings settings = null;

View File

@@ -35,7 +35,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private readonly DispatcherQueue _dispatcherQueue;
private readonly ISettingsUtils _settingsUtils;
private readonly SettingsUtils _settingsUtils;
private readonly PeekPreviewSettings _peekPreviewSettings;
private PeekSettings _peekSettings;
@@ -47,7 +47,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private IFileSystemWatcher _watcher;
public PeekViewModel(
ISettingsUtils settingsUtils,
SettingsUtils settingsUtils,
ISettingsRepository<GeneralSettings> settingsRepository,
Func<string, int> ipcMSGCallBackFunc,
DispatcherQueue dispatcherQueue)

View File

@@ -21,7 +21,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private readonly PowerAccentSettings _powerAccentSettings;
private readonly ISettingsUtils _settingsUtils;
private readonly SettingsUtils _settingsUtils;
private const string SpecialGroup = "QuickAccent_Group_Special";
private const string LanguageGroup = "QuickAccent_Group_Language";
@@ -89,7 +89,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private Func<string, int> SendConfigMSG { get; }
public PowerAccentViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc)
public PowerAccentViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc)
{
// To obtain the general settings configurations of PowerToys Settings.
ArgumentNullException.ThrowIfNull(settingsRepository);

View File

@@ -32,7 +32,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private GeneralSettings GeneralSettingsConfig { get; set; }
private readonly ISettingsUtils _settingsUtils;
private readonly SettingsUtils _settingsUtils;
private readonly System.Threading.Lock _delayedActionLock = new System.Threading.Lock();
private readonly PowerOcrSettings _powerOcrSettings;
@@ -72,7 +72,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private Func<string, int> SendConfigMSG { get; }
public PowerOcrViewModel(
ISettingsUtils settingsUtils,
SettingsUtils settingsUtils,
ISettingsRepository<GeneralSettings> settingsRepository,
ISettingsRepository<PowerOcrSettings> powerOcrsettingsRepository,
Func<string, int> ipcMSGCallBackFunc)

View File

@@ -18,7 +18,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
private GeneralSettings GeneralSettingsConfig { get; set; }
private readonly ISettingsUtils _settingsUtils;
private readonly SettingsUtils _settingsUtils;
private const string ModuleName = PowerRenameSettings.ModuleName;
@@ -28,7 +28,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private Func<string, int> SendConfigMSG { get; }
public PowerRenameViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
public PowerRenameViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
{
// Update Settings file folder:
_settingsConfigFileFolder = configFileSubfolder;

View File

@@ -36,7 +36,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private ResourceLoader resourceLoader;
public ShortcutConflictViewModel(
ISettingsUtils settingsUtils,
SettingsUtils settingsUtils,
ISettingsRepository<GeneralSettings> settingsRepository,
Func<string, int> ipcMSGCallBackFunc)
{

View File

@@ -20,7 +20,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
protected override string ModuleName => ShortcutGuideSettings.ModuleName;
private ISettingsUtils SettingsUtils { get; set; }
private SettingsUtils SettingsUtils { get; set; }
private GeneralSettings GeneralSettingsConfig { get; set; }
@@ -31,7 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private string _settingsConfigFileFolder = string.Empty;
private string _disabledApps;
public ShortcutGuideViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<ShortcutGuideSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
public ShortcutGuideViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<ShortcutGuideSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
{
SettingsUtils = settingsUtils;

View File

@@ -21,7 +21,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
protected override string ModuleName => WorkspacesSettings.ModuleName;
private ISettingsUtils SettingsUtils { get; set; }
private SettingsUtils SettingsUtils { get; set; }
private GeneralSettings GeneralSettingsConfig { get; set; }
@@ -31,7 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
public ButtonClickCommand LaunchEditorEventHandler { get; set; }
public WorkspacesViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<WorkspacesSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
public WorkspacesViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, ISettingsRepository<WorkspacesSettings> moduleSettingsRepository, Func<string, int> ipcMSGCallBackFunc)
{
ArgumentNullException.ThrowIfNull(settingsUtils);

View File

@@ -27,7 +27,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private const string FormatGif = "GIF";
private const string FormatMp4 = "MP4";
private ISettingsUtils SettingsUtils { get; set; }
private SettingsUtils SettingsUtils { get; set; }
private GeneralSettings GeneralSettingsConfig { get; set; }
@@ -72,7 +72,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
IncludeFields = true,
};
public ZoomItViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, Func<string, string, string, int, string> pickFileDialog, Func<LOGFONT, LOGFONT> pickFontDialog)
public ZoomItViewModel(SettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, Func<string, string, string, int, string> pickFileDialog, Func<LOGFONT, LOGFONT> pickFontDialog)
{
ArgumentNullException.ThrowIfNull(settingsUtils);