瀏覽代碼

sandbox demo of shutdown cancel.

Dan Walmsley 4 年之前
父節點
當前提交
851baa6537
共有 1 個文件被更改,包括 7 次插入0 次删除
  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;
+        }
     }
 }