Document.TouchScreen/App.xaml.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using System.Windows.Threading;

namespace Document.TouchScreen
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
        public App()
        {
                
        }

        private void Application_Startup(object sender, StartupEventArgs e)
        {
             Current.DispatcherUnhandledException += App_OnDispatcherUnhandledException;
              AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
        }

        /// <summary>
        /// UI线程抛出全局异常事件处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void App_OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            try
            {
                GMS.Core.Log.Log4NetHelper.WriteLog("UI线程全局异常", e.Exception);
                e.Handled = true;
            }
            catch (Exception ex)
            {   
                GMS.Core.Log.Log4NetHelper.WriteLog("UI线程全局异常", ex);
                MessageBox.Show("应用程序发生不可恢复的异常,将要退出!");
            }
        }

        /// <summary>
        /// 非UI线程抛出全局异常事件处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            try
            {
                var exception = e.ExceptionObject as Exception;
                if (exception != null)
                {
                    GMS.Core.Log.Log4NetHelper.WriteLog("UI线程全局异常", exception);
                }
            }
后面还有 9 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。