整理一下项目文件

This commit is contained in:
艾竹
2022-10-28 22:45:39 +08:00
parent 334297b074
commit 513937c1d6
598 changed files with 684 additions and 544 deletions

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
//注意下面的语句一定要加上指定log4net使用.config文件来读取配置信息
//如果是WinForm假定程序为MyDemo.exe则需要一个MyDemo.exe.config文件
//如果是WebForm则从web.config中读取相关信息
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
namespace AIStudio.Wpf.DiagramApp
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
public App()
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.Current.DispatcherUnhandledException += Application_DispatcherUnhandledException;
}
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
//记录严重错误
log.Fatal(e.Exception);
e.Handled = true;//使用这一行代码告诉运行时该异常被处理了不再作为UnhandledException抛出了。
}
void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
//记录严重错误
log.Fatal(e.ExceptionObject);
}
}
}