終了オプションを持つメニューからウィンドウを閉じることによってアプリケーションを閉じたいと思います。両方ともプロンプトメッセージを追加しました。 しかし、私はあなたがExit
ボタンを押すか、あなたはALT + F4
でアプリケーションを閉じるか、右アップX (cross)
が押されるたび、それはShellWindow_Closing
終了メニューと終了イベントを使用してアプリケーションをシャットダウン
public partial class SWindow : Window
{
public SWindow()
{
this.Closing += ShellWindow_Closing;
}
private void ShellWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (MessageBox.Show("Any running migration task will be aborted. \nAre you sure you want to exit the application ?",
"Exit Proventeq Migration Acclerator",
MessageBoxButton.YesNo,
MessageBoxImage.Question) == MessageBoxResult.No)
e.Cancel = true;
}
}
private void Exit_Click(object sender, RoutedEventArgs e)
{
if (MessageBox.Show("Any running migration task will be aborted. \nAre you sure you want to exit the application ?", "Exit Proventeq Migration Acclerator", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
e.Handled = true;
}
質問の書式を設定してください。 – FCin
[X]ボタンをクリックしたときの確認の依頼](0120-998-501) –
終了メニューからハンドラセットe.Handled = true;他のハンドラを呼び出すべきではない – adminSoftDK