未処理の例外が発生したときにポップアップする素敵な Windows フォームを作成する方法を見つけようとしています。私は現在持っています:
// Add the event handler for handling UI thread exceptions
Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException );
// Add the event handler for handling non-UI thread exceptions
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler( CurrentDomain_UnhandledException );
static void CurrentDomain_UnhandledException( object sender, UnhandledExceptionEventArgs e )
{
MessageBox.Show( e.ToString( ), "Unhandled Non-UI Thread Exception" );
}
static void Application_ThreadException( object sender, ThreadExceptionEventArgs e )
{
MessageBox.Show( e.ToString( ), "Unhandled UI Thread Exception" );
}
しかし、私が探しているのは、threadexception メソッドで、エラーに関する情報を含む Windows フォームをポップアップし、続行/終了/再起動することです。これは、ググると、特定の場合に組み込まれているように見えるものと非常によく似ていますが、呼び出すことができる何らかの変更可能/カスタムのものを作成することは可能ですか?
申し訳ありませんが、コードの間違った部分を意図せずに貼り付けました。現在、メッセージ ボックスを使用していますが、いくつかの機能的なボタンを備えた、もう少し強化されたメッセージ ボックスが必要です。
本当にありがとう。