From 104cad5ee53eb05d3a89d508a029425726ae89ae Mon Sep 17 00:00:00 2001
From: chr <chr@mailcom>
Date: 星期一, 24 二月 2025 13:40:52 +0800
Subject: [PATCH] 上传长时间代码;
---
WPFProject/App.xaml.cs | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/WPFProject/App.xaml.cs b/WPFProject/App.xaml.cs
index 437e4c9..2715cec 100644
--- a/WPFProject/App.xaml.cs
+++ b/WPFProject/App.xaml.cs
@@ -5,6 +5,10 @@
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
+using HMI.UI.Util;
+using System.Windows.Markup;
+using log4net;
+using Panuon.WPF.UI;
namespace WPFProject
{
@@ -13,14 +17,26 @@
/// </summary>
public partial class App : Application
{
- public void test()
+ private ILog log;
+ public App()
{
-
+ log = LogManager.GetLogger("APP");
+ AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
+ }
+
+ private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
+ {
+ log.Error("鏈煡寮傚父", e.ExceptionObject as Exception);
+ Dispatcher.Invoke(() =>
+ {
+ MsgBoxHelper.ErrorMessage(Current.MainWindow, $"鍙戠敓鏈煡寮傚父锛佺▼搴忓嵆灏嗗叧闂�", "閿欒", MessageBoxButton.OK,
+ MessageBoxIcon.Error, DefaultButton.YesOK, 5);
+ });
}
private void Application_Startup(object sender, StartupEventArgs e)
{
- MainWindow window = new MainWindow();
+ LoadingWindow window = new LoadingWindow();
window.Show();
}
}
--
Gitblit v1.9.1