From 2e54b439c64e0adbb7e010243c1f33aa5fc5f503 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期二, 11 三月 2025 14:08:57 +0800
Subject: [PATCH] 完善程序; Merge branch 'master' of http://58.211.88.246:3600/r/WPF/WPFProject
---
WPFProject/App.xaml.cs | 34 ++++++++++++++++++++++++----------
1 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/WPFProject/App.xaml.cs b/WPFProject/App.xaml.cs
index 2715cec..2a6f66f 100644
--- a/WPFProject/App.xaml.cs
+++ b/WPFProject/App.xaml.cs
@@ -1,14 +1,12 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows;
+锘縰sing HMI.Core.Util;
using HMI.UI.Util;
-using System.Windows.Markup;
using log4net;
using Panuon.WPF.UI;
+using System;
+using System.IO;
+using System.Windows;
+using System.Windows.Markup;
+using WPFProject.Utils;
namespace WPFProject
{
@@ -26,18 +24,34 @@
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
- log.Error("鏈煡寮傚父", e.ExceptionObject as Exception);
+ var ex = e.ExceptionObject as Exception;
+ log.Error("UnhandledException.", ex);
Dispatcher.Invoke(() =>
{
- MsgBoxHelper.ErrorMessage(Current.MainWindow, $"鍙戠敓鏈煡寮傚父锛佺▼搴忓嵆灏嗗叧闂�", "閿欒", MessageBoxButton.OK,
+ MsgBoxHelper.ErrorMessage(Current.MainWindow, $"鍙戠敓鏈煡寮傚父锛佺▼搴忓嵆灏嗗叧闂璡r\n{ex?.Message}",
+ "閿欒", MessageBoxButton.OK,
MessageBoxIcon.Error, DefaultButton.YesOK, 5);
});
}
private void Application_Startup(object sender, StartupEventArgs e)
{
+ LangUtil.Load();
+ ToastHelper.Register(new MainToastHandler());
LoadingWindow window = new LoadingWindow();
+ //Login window = new Login();
window.Show();
}
+
+
+ private void LoadLang()
+ {
+ string path = "Lang/zh-CN/app.xaml";
+ using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
+ {
+ var dict = (ResourceDictionary)XamlReader.Load(fs);
+ Application.Current.Resources.MergedDictionaries.Add(dict);
+ }
+ }
}
}
--
Gitblit v1.9.1