diff --git a/src/SharpIDE.Godot/IdeWindow.cs b/src/SharpIDE.Godot/IdeWindow.cs index b7360c9..7ead535 100644 --- a/src/SharpIDE.Godot/IdeWindow.cs +++ b/src/SharpIDE.Godot/IdeWindow.cs @@ -27,6 +27,7 @@ public partial class IdeWindow : Control MSBuildLocator.RegisterDefaults(); GodotServiceDefaults.AddServiceDefaults(); Singletons.AppState = AppStateLoader.LoadAppStateFromConfigFile(); + GetWindow().FocusExited += OnFocusExited; //GetWindow().SetMinSize(new Vector2I(1152, 648)); Callable.From(() => PickSolution(true)).CallDeferred(); } @@ -42,6 +43,11 @@ public partial class IdeWindow : Control // PrintOrphanNodes(); } + private void OnFocusExited() + { + _ = Task.GodotRun(async () => await Singletons.FileManager.SaveAllOpenFilesAsync()); + } + public void PickSolution(bool fullscreen = false) { if (_slnPicker is not null) throw new InvalidOperationException("Solution picker is already active");