| | |
| | | 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 |
| | | { |
| | |
| | | /// </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(); |
| | | } |
| | | } |