PowerToys/Wox.CrashReporter/ReportWindow.xaml.cs

63 lines
1.9 KiB
C#
Raw Normal View History

2015-01-11 21:52:30 +08:00
using System;
2015-01-16 23:42:12 +08:00
using System.Threading;
2015-01-11 21:52:30 +08:00
using System.Windows;
using System.Windows.Documents;
using Exceptionless;
using Wox.Core.Resource;
2015-01-27 21:51:29 +08:00
using Wox.Core.Updater;
2015-01-11 21:52:30 +08:00
namespace Wox.CrashReporter
{
2015-01-12 22:46:36 +08:00
internal partial class ReportWindow
2015-01-11 21:52:30 +08:00
{
private Exception exception;
public ReportWindow(Exception exception)
{
this.exception = exception;
InitializeComponent();
SetException(exception);
}
private void SetException(Exception exception)
{
tbSummary.AppendText(exception.Message);
2015-01-27 21:51:29 +08:00
tbVersion.Text = UpdaterManager.Instance.CurrentVersion.ToString();
2015-01-11 21:52:30 +08:00
tbDatetime.Text = DateTime.Now.ToString();
tbStackTrace.AppendText(exception.StackTrace);
tbSource.Text = exception.Source;
tbType.Text = exception.GetType().ToString();
}
private void btnSend_Click(object sender, RoutedEventArgs e)
{
2015-01-21 23:00:56 +08:00
string sendingMsg = InternationalizationManager.Instance.GetTranslation("reportWindow_sending");
2015-01-12 22:46:36 +08:00
tbSendReport.Content = sendingMsg;
2015-01-11 21:52:30 +08:00
btnSend.IsEnabled = false;
SendReport();
2015-01-16 23:42:12 +08:00
}
private void SendReport()
{
2015-02-10 23:48:09 +08:00
Hide();
ThreadPool.QueueUserWorkItem(o =>
{
string reproduceSteps = new TextRange(tbReproduceSteps.Document.ContentStart, tbReproduceSteps.Document.ContentEnd).Text;
exception.ToExceptionless()
.SetUserDescription(reproduceSteps)
.Submit();
ExceptionlessClient.Current.ProcessQueue();
2016-01-07 05:34:42 +08:00
Dispatcher.Invoke(() =>
{
Close();
2016-01-07 05:34:42 +08:00
});
});
2015-01-11 21:52:30 +08:00
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
Close();
}
}
}