alielie
2025-03-13 a3ba25607612818c28d421bfa8eb2f92339d71ac
WPFProject/App.xaml.cs
@@ -3,9 +3,7 @@
using log4net;
using Panuon.WPF.UI;
using System;
using System.IO;
using System.Windows;
using System.Windows.Markup;
using WPFProject.Utils;
namespace WPFProject
@@ -26,12 +24,9 @@
        {
            var ex = e.ExceptionObject as Exception;
            log.Error("UnhandledException.", ex);
            Dispatcher.Invoke(() =>
            {
                MsgBoxHelper.ErrorMessage(Current.MainWindow, $"发生未知异常!程序即将关闭\r\n{ex?.Message}",
                    "错误", MessageBoxButton.OK,
            MsgBoxHelper.ErrorMessage(Current.MainWindow, this.lang("App.AppUnhandledException",ex.Message),
                    this.lang("App.Error"), MessageBoxButton.OK,
                    MessageBoxIcon.Error, DefaultButton.YesOK, 5);
            });
        }
        private void Application_Startup(object sender, StartupEventArgs e)
@@ -41,17 +36,6 @@
            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);
            }
        }
    }
}