From 9e2e7aabe8eec305a6280266e7d7f7e7d01c71f1 Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Sun, 8 Dec 2024 21:51:40 -0500 Subject: [PATCH] Fix hang when moving window during refresh --- Application/MainWindow/WindowHandler.cs | 4 ++-- Application/SettingsStore.cs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Application/MainWindow/WindowHandler.cs b/Application/MainWindow/WindowHandler.cs index ad3d4ae..76f23db 100644 --- a/Application/MainWindow/WindowHandler.cs +++ b/Application/MainWindow/WindowHandler.cs @@ -49,14 +49,14 @@ public partial class MainWindow { // Set the last window location Settings.Default.WindowLocation = new Point(Left, Top); + Settings.Default.Save(); // Set the last window size Settings.Default.WindowSize = new Size(Width, Height); + Settings.Default.Save(); // Save the dock on the navigation tray Settings.Default.ToolbarLocation = NameBasedGrid.NameBasedGrid.GetRow(NavigationToolbarTray) == "TopToolbarRow" ? Dock.Top : Dock.Bottom; - - // Save settings Settings.Default.Save(); } diff --git a/Application/SettingsStore.cs b/Application/SettingsStore.cs index d9ff93f..2b5c820 100644 --- a/Application/SettingsStore.cs +++ b/Application/SettingsStore.cs @@ -36,6 +36,9 @@ public static class SettingsStore // Try to get the setting from the database that matches the name and version var setting = entities.Settings.FirstOrDefault(s => s.Name == name); + if (setting?.Value == value) + return; + entities.SaveChanges(() => { // If there was no setting we need to create it