Browse Source

Add MockSettingsManager for design mode without IO

pull/55/head
Ionite 1 year ago
parent
commit
bbeae31fc4
No known key found for this signature in database
  1. 2
      StabilityMatrix.Avalonia/DesignData/DesignData.cs
  2. 9
      StabilityMatrix.Avalonia/DesignData/MockSettingsManager.cs
  3. 4
      StabilityMatrix.Core/Services/SettingsManager.cs

2
StabilityMatrix.Avalonia/DesignData/DesignData.cs

@ -17,7 +17,7 @@ public static class DesignData
{
static DesignData()
{
var settingsManager = new SettingsManager
var settingsManager = new MockSettingsManager
{
Settings =
{

9
StabilityMatrix.Avalonia/DesignData/MockSettingsManager.cs

@ -0,0 +1,9 @@
using StabilityMatrix.Core.Services;
namespace StabilityMatrix.Avalonia.DesignData;
public class MockSettingsManager : SettingsManager
{
protected override void LoadSettings() {}
protected override void SaveSettings() {}
}

4
StabilityMatrix.Core/Services/SettingsManager.cs

@ -423,7 +423,7 @@ public class SettingsManager : ISettingsManager
/// Loads settings from the settings file
/// If the settings file does not exist, it will be created with default values
/// </summary>
private void LoadSettings()
protected virtual void LoadSettings()
{
FileLock.EnterReadLock();
try
@ -451,7 +451,7 @@ public class SettingsManager : ISettingsManager
}
}
private void SaveSettings()
protected virtual void SaveSettings()
{
FileLock.TryEnterWriteLock(100000);
try

Loading…
Cancel
Save