forked from NickeManarin/ScreenToGif
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExceptionViewer.xaml.cs
56 lines (41 loc) · 1.28 KB
/
ExceptionViewer.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
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Windows;
namespace Translator;
public partial class ExceptionViewer
{
#region Variables
private readonly Exception _exception;
#endregion
/// <summary>
/// Default constructor.
/// </summary>
/// <param name="ex">The Exception to show.</param>
public ExceptionViewer(Exception ex)
{
InitializeComponent();
_exception = ex;
#region Shows Information
TypeLabel.Content = ex.GetType().Name;
MessageTextBox.Text = ex.Message;
StackTextBox.Text = ex.StackTrace;
SourceTextBox.Text = ex.Source;
if (ex.TargetSite != null)
SourceTextBox.Text += "." + ex.TargetSite.Name;
//If there's additional details.
if (!string.IsNullOrEmpty(ex.HelpLink))
StackTextBox.Text += Environment.NewLine + Environment.NewLine + ex.HelpLink;
if (ex.InnerException != null)
InnerButton.IsEnabled = true;
#endregion
}
private void InnerButton_Click(object sender, RoutedEventArgs e)
{
var errorViewer = new ExceptionViewer(_exception.InnerException);
errorViewer.ShowDialog();
GC.Collect(1);
}
private void DoneButton_Click(object sender, RoutedEventArgs e)
{
Close();
}
}