You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.9 KiB
54 lines
1.9 KiB
using DemoUI.Common;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
|
|
namespace DemoUI
|
|
{
|
|
/// <summary>
|
|
/// App.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class App : Application
|
|
{
|
|
QMLog log = new QMLog();
|
|
private void Application_Startup(object sender, StartupEventArgs e)
|
|
{
|
|
|
|
try
|
|
{
|
|
log.WriteLogFile("正常启动", "start");
|
|
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
|
Application.Current.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(Current_DispatcherUnhandledException);
|
|
AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
|
|
MainWindow win = new MainWindow();
|
|
win.Show();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.WriteLogFile(ex.ToString(), "StartupError");
|
|
MessageBox.Show("程序启动失败");
|
|
}
|
|
}
|
|
private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
|
{
|
|
log.WriteLogFile(e.Exception.Message + e.Exception.StackTrace, "APPError");
|
|
}
|
|
|
|
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
|
{
|
|
Exception ex = (Exception)e.ExceptionObject;
|
|
log.WriteLogFile(ex.Message + ex.StackTrace, "APPError");
|
|
}
|
|
|
|
private void CurrentDomain_ProcessExit(object sender, EventArgs e)
|
|
{
|
|
log.WriteLogFile("程序关闭", "start");
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|