From 6038eee6803f3f166384ec9d607f9043dc0e3d10 Mon Sep 17 00:00:00 2001 From: liufei Date: Wed, 5 Jan 2022 17:11:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8D=95=E8=8E=B7=E6=9C=AA=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.xaml.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/App.xaml.cs b/App.xaml.cs index d1066f8..4d1bbba 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -21,6 +21,8 @@ namespace GeekDesk public App() { this.Startup += new StartupEventHandler(App_Startup); + Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; } private void App_Startup(object sender, StartupEventArgs e) @@ -42,6 +44,7 @@ namespace GeekDesk { e.Handled = true;//使用这一行代码告诉运行时,该异常被处理了,不再作为UnhandledException抛出了。 LogUtil.WriteErrorLog(e, "未捕获异常!"); + MessageBox.Show("GeekDesk遇到一个问题, 不用担心, 这不影响其它操作!"); } void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)