xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Application Shutdown Sample" Closing="ChildWindow_Closing" Closed="ChildWindow_Closed">
//File:Window.xaml.vb
Imports System
Imports System.ComponentModel
Imports System.Windows
Namespace ApplicationShutdownSample
Public Partial Class ChildWindow
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
Private Sub ChildWindow_Closing(sender As Object, e As CancelEventArgs)
Console.WriteLine("Closing")
Dim result As MessageBoxResult = MessageBox.Show("Allow Shutdown?", "Application Shutdown Sample", MessageBoxButton.YesNo, MessageBoxImage.Question)
e.Cancel = (result = MessageBoxResult.No)
End Sub
Private Sub ChildWindow_Closed(sender As Object, e As EventArgs)
Console.WriteLine("Closed")
End Sub
End Class
End Namespace