From 8a8cca00f648c24ffc64f7cb77ef003ad67d0f76 Mon Sep 17 00:00:00 2001 From: Ionite Date: Thu, 30 Nov 2023 19:10:03 -0500 Subject: [PATCH] Ensure Loaded event call when loading default settings --- StabilityMatrix.Core/Services/SettingsManager.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/StabilityMatrix.Core/Services/SettingsManager.cs b/StabilityMatrix.Core/Services/SettingsManager.cs index 38da83e5..7a112cc0 100644 --- a/StabilityMatrix.Core/Services/SettingsManager.cs +++ b/StabilityMatrix.Core/Services/SettingsManager.cs @@ -625,6 +625,8 @@ public class SettingsManager : ISettingsManager var settingsJson = JsonSerializer.Serialize(Settings); settingsFile.WriteAllText(settingsJson); + + Loaded?.Invoke(this, EventArgs.Empty); return; } @@ -645,8 +647,9 @@ public class SettingsManager : ISettingsManager ) { Settings = loadedSettings; - Loaded?.Invoke(this, EventArgs.Empty); } + + Loaded?.Invoke(this, EventArgs.Empty); } finally { @@ -671,6 +674,7 @@ public class SettingsManager : ISettingsManager Settings, SettingsSerializerContext.Default.Settings ); + File.WriteAllBytes(SettingsPath, jsonBytes); } finally