Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/WindowResizer.Configuration/ProfilesFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public static class ProfilesFactory
private static string _portableConfigPath = string.Empty;

public static bool PortableMode;
public static bool PostponeSaving = false;
public static string ConfigPath = string.Empty;

public static void SetPath(string roamingPath, string portablePath)
Expand Down Expand Up @@ -78,7 +79,8 @@ public static void Save()
{
var json = JsonConvert.SerializeObject(Profiles);
new FileInfo(ConfigPath).Directory?.Create();
File.WriteAllText(ConfigPath, json);

if (!PostponeSaving) File.WriteAllText(ConfigPath, json);

Profiles.Updated();
}
Expand Down
4 changes: 4 additions & 0 deletions src/WindowResizer/TrayContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ private void OnKeyPressed(object sender, KeyPressedEventArgs e)
private void SaveAll()
{
var windows = Resizer.GetOpenWindows();
ProfilesFactory.PostponeSaving = true;
foreach (var window in windows)
{
if (Resizer.GetWindowState(window) != WindowState.Minimized)
Expand All @@ -397,6 +398,9 @@ private void SaveAll()
}
}

ProfilesFactory.PostponeSaving = false;
ProfilesFactory.Save();

if (ProfilesFactory.Current.NotifyOnSaved)
{
Toast.ShowToast(
Expand Down