Browse Source

sandbox demo of shutdown cancel.

Dan Walmsley 4 years ago
parent
commit
851baa6537
1 changed files with 7 additions and 0 deletions
  1. 7 0
      samples/Sandbox/App.axaml.cs

+ 7 - 0
samples/Sandbox/App.axaml.cs

@@ -16,7 +16,14 @@ namespace Sandbox
             if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLifetime)
             {
                 desktopLifetime.MainWindow = new MainWindow();
+
+                desktopLifetime.ShutdownRequested += DesktopLifetime_ShutdownRequested;
             }
         }
+
+        private void DesktopLifetime_ShutdownRequested(object sender, System.ComponentModel.CancelEventArgs e)
+        {
+            e.Cancel = true;
+        }
     }
 }