Browse Source

Autosave all on crash

Krzysztof Krysiński 1 năm trước cách đây
mục cha
commit
2141eba878
1 tập tin đã thay đổi với 12 bổ sung1 xóa
  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)