示例:WPF注册补货全局异常


用途:如题

        #region - 注册全局异常 -

        static StartWindow()
        {
            /// <summary> 注册全局异常 </summary>
            System.Windows.Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;

        }

        /// <summary> 补货全局异常 </summary>
        static void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {

            System.Windows.MessageBox.Show(e.Exception.Message);

            e.Handled = true;
        }


        #endregion


猜你喜欢

转载自blog.csdn.net/u010975589/article/details/61199019
今日推荐