-
Notifications
You must be signed in to change notification settings - Fork 3
/
GlobalExceptionHandleWindow.xaml.cs
43 lines (36 loc) · 1.25 KB
/
GlobalExceptionHandleWindow.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Diagnostics;
using System.Windows;
using Wpf.Ui.Controls;
namespace McHMR_Updater_v2
{
public partial class GlobalExceptionHandleWindow : FluentWindow
{
private readonly string _errorText;
private readonly Exception _exception;
public GlobalExceptionHandleWindow(Exception exception)
{
InitializeComponent();
Loaded += (sender, args) =>
{
Wpf.Ui.Appearance.SystemThemeWatcher.Watch(this);
};
_exception = exception;
_errorText = exception.Message + "\r\n" + exception + "\r\n" + exception.Data + "\r\n" + exception.StackTrace;
errorText.Text += exception.Message + "\r\n" + exception + "\r\n" + exception.Data + "\r\n" + exception.StackTrace;
errorTitle.Title = exception.Message;
}
private void copyBtn_Click(object sender, RoutedEventArgs e)
{
Clipboard.SetText(_errorText);
}
private void closeBtn_Click(object sender, RoutedEventArgs e)
{
if (_exception.Message.Equals("网络未连接"))
{
Process.GetCurrentProcess().Kill();
}
this.Close();
}
}
}