• WinFrom Exception Handler


     1 [STAThread]
    2 static void Main()
    3 {
    4 Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
    5 AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
    6 Application.EnableVisualStyles();
    7 Application.SetCompatibleTextRenderingDefault(false);
    8 Application.Run(new Form1());
    9 }
    10 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
    11 {
    12 MessageBox.Show("抱歉,您的操作没有能够完成,请再试一次或者联系软件提供商");
    13 LogUnhandledException(e.ExceptionObject);
    14 }
    15 static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
    16 {
    17 MessageBox.Show("抱歉,您的操作没有能够完成,请再试一次或者联系软件提供商");
    18 LogUnhandledException(e.Exception);
    19 }
    20 static void LogUnhandledException(object exceptionobj)
    21 { //Log the exception here or report it to developer }
    22 }
  • 相关阅读:
    elasticsearch之建议器Suggester
    elasticsearch,kibana之相关配置
    elasticsearch之分析过程
    elasticsearch之mappings
    elasticsearch for Mac OS
    项目精讲
    博客园项目开发流程
    Django之auth模块
    DJango中间件
    DJango之模板层
  • 原文地址:https://www.cnblogs.com/TeyGao/p/2429504.html
Copyright © 2020-2023  润新知