次のようなアプリケーション ファイル XAML を持つ WPF/C# 4.0 アプリがあります。
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="XXX.App"
Startup="Application_Startup"
Exit="Application_Exit"
>
<Application.Resources>
</Application.Resources>
そして、その終了方法は次のとおりです。
//it seems that it never passes here. Transferred to MainAppWindow_WindowClosing
private void Application_Exit(object sender, ExitEventArgs e)
{
this.Dispatcher.BeginInvokeShutdown(DispatcherPriority.Background);
}
アプリケーション ユーザーがコードを閉じたときに、このコードが渡されることはありません。このように動作するはずですか?私は何か間違ったことをしていますか?