Browse Source

Autosave all on crash

Krzysztof Krysiński 1 year ago
parent
commit
2141eba878
1 changed files with 12 additions and 1 deletions
  1. 12 1
      src/PixiEditor/Views/MainWindow.xaml.cs

+ 12 - 1
src/PixiEditor/Views/MainWindow.xaml.cs

@@ -277,7 +277,18 @@ internal partial class MainWindow : Window
 
     private void MainWindow_Initialized(object sender, EventArgs e)
     {
-        AppDomain.CurrentDomain.UnhandledException += (sender, e) => Helpers.CrashHelper.SaveCrashInfo((Exception)e.ExceptionObject);
+        AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
+        {
+            try
+            {
+                DataContext.AutosaveAllForNextSession();
+            }
+            finally
+            {
+                CrashHelper.SaveCrashInfo((Exception)e.ExceptionObject);
+
+            }
+        };
     }
 
     private void MainWindow_Drop(object sender, DragEventArgs e)