WPF的Application类中有一个事件:DispatcherUnhandledException,在应用程序未对其中的异常加以处理的情况下发生,从而为应用程序把好最后的大门

 1 namespace Chapter1_WpfApplication1
 2 {
 3     /// <summary>
 4     /// Interaction logic for App.xaml
 5     /// </summary>
 6     public partial class App : Application
 7     {
 8         protected override void OnStartup(StartupEventArgs e)
 9         {
10             base.OnStartup(e);
11 
12             this.DispatcherUnhandledException += App_DispatcherUnhandledException;
13         }
14 
15         void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
16         {
17             throw new NotImplementedException();
18         }
19     }
20 }
View Code

相关文章:

  • 2021-06-19
  • 2021-12-04
  • 2021-12-04
  • 2021-07-02
  • 2021-07-11
  • 2021-06-20
  • 2021-07-13
  • 2021-05-19
猜你喜欢
  • 2022-12-23
  • 2021-06-28
  • 2021-06-08
  • 2021-11-28
  • 2021-09-30
  • 2021-11-19
  • 2021-05-22
相关资源
相似解决方案