From 2b1a6417285597bc58ef28aa3f01aeee2532cd19 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期二, 04 三月 2025 13:36:17 +0800
Subject: [PATCH] 优化UI;

---
 WPFProject/App.xaml.cs |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/WPFProject/App.xaml.cs b/WPFProject/App.xaml.cs
index 437e4c9..882f867 100644
--- a/WPFProject/App.xaml.cs
+++ b/WPFProject/App.xaml.cs
@@ -1,9 +1,7 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
+锘縰sing HMI.UI.Util;
+using log4net;
+using Panuon.WPF.UI;
+using System;
 using System.Windows;
 
 namespace WPFProject
@@ -13,14 +11,28 @@
     /// </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)
+        {
+            var ex = e.ExceptionObject as Exception;
+            log.Error("UnhandledException.", ex);
+            Dispatcher.Invoke(() =>
+            {
+                MsgBoxHelper.ErrorMessage(Current.MainWindow, $"鍙戠敓鏈煡寮傚父锛佺▼搴忓嵆灏嗗叧闂璡r\n{ex?.Message}",
+                    "閿欒", 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