From 59d91ec2ae6d50296fca61694cd48128634f50a1 Mon Sep 17 00:00:00 2001 From: STBBRD <62409850+STBBRD@users.noreply.github.com> Date: Sat, 19 Oct 2024 22:11:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=85=A5=20Sentry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZongziTEK_Blackboard_Sticker/App.xaml.cs | 22 +++++++++++++++++-- .../Pages/WelcomePages/WelcomePage0.xaml | 1 + .../ZongziTEK_Blackboard_Sticker.csproj | 4 ++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ZongziTEK_Blackboard_Sticker/App.xaml.cs b/ZongziTEK_Blackboard_Sticker/App.xaml.cs index 13ef5be..3a031d2 100644 --- a/ZongziTEK_Blackboard_Sticker/App.xaml.cs +++ b/ZongziTEK_Blackboard_Sticker/App.xaml.cs @@ -7,6 +7,8 @@ using AutoUpdaterDotNET; using System.Globalization; using ZongziTEK_Blackboard_Sticker.Helpers; +using System.Diagnostics; +using Sentry; namespace ZongziTEK_Blackboard_Sticker { @@ -19,7 +21,18 @@ public partial class App : Application public App() { - this.Startup += new StartupEventHandler(App_Startup); + this.Startup += new StartupEventHandler(App_Startup); + + SentrySdk.Init(o => + { + // Tells which project in Sentry to send events to: + o.Dsn = "https://be9e01f3b4459566b40b8bbc1ce7f8be@o4508149744140288.ingest.de.sentry.io/4508149746040912"; + // When configuring for the first time, to see what the SDK is doing: + o.Debug = true; + // Set TracesSampleRate to 1.0 to capture 100% of transactions for tracing. + // We recommend adjusting this value in production. + o.TracesSampleRate = 1.0; + }); } void App_Startup(object sender, StartupEventArgs e) @@ -39,9 +52,14 @@ private void Application_DispatcherUnhandledException(object sender, System.Wind try { e.Handled = true; + SentrySdk.CaptureException(e.Exception); LogHelper.WriteLogToFile(e.Exception.Message, LogHelper.LogType.Error); } - catch { } + catch + { + Process.Start(System.Windows.Forms.Application.ExecutablePath, "-m"); + Shutdown(); + } } } diff --git a/ZongziTEK_Blackboard_Sticker/Pages/WelcomePages/WelcomePage0.xaml b/ZongziTEK_Blackboard_Sticker/Pages/WelcomePages/WelcomePage0.xaml index dfecb38..3ff8bff 100644 --- a/ZongziTEK_Blackboard_Sticker/Pages/WelcomePages/WelcomePage0.xaml +++ b/ZongziTEK_Blackboard_Sticker/Pages/WelcomePages/WelcomePage0.xaml @@ -19,6 +19,7 @@ + diff --git a/ZongziTEK_Blackboard_Sticker/ZongziTEK_Blackboard_Sticker.csproj b/ZongziTEK_Blackboard_Sticker/ZongziTEK_Blackboard_Sticker.csproj index 01c1268..ad3b4ea 100644 --- a/ZongziTEK_Blackboard_Sticker/ZongziTEK_Blackboard_Sticker.csproj +++ b/ZongziTEK_Blackboard_Sticker/ZongziTEK_Blackboard_Sticker.csproj @@ -101,6 +101,7 @@ TimetableLesson.xaml + CountdownPage.xaml @@ -400,6 +401,9 @@ 13.0.3 + + 4.12.1 +