mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-25 22:25:00 +00:00
feature<Issue>: create Gitee issue when unhandled exception raised
This commit is contained in:
parent
89c0f0077e
commit
a56a3ac5d2
3 changed files with 91 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace SourceGit {
|
||||
|
@ -26,7 +27,12 @@ namespace SourceGit {
|
|||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnAppStartup(object sender, StartupEventArgs e) {
|
||||
protected override void OnStartup(StartupEventArgs e) {
|
||||
base.OnStartup(e);
|
||||
|
||||
// 崩溃上报
|
||||
AppDomain.CurrentDomain.UnhandledException += (_, ev) => Models.Issue.Create(ev.ExceptionObject as Exception);
|
||||
|
||||
// 创建必要目录
|
||||
if (!Directory.Exists(Views.Controls.Avatar.CACHE_PATH)) {
|
||||
Directory.CreateDirectory(Views.Controls.Avatar.CACHE_PATH);
|
||||
|
@ -79,7 +85,8 @@ namespace SourceGit {
|
|||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnAppDeactivated(object sender, EventArgs e) {
|
||||
protected override void OnDeactivated(EventArgs e) {
|
||||
base.OnDeactivated(e);
|
||||
GC.Collect();
|
||||
Models.Preference.Save();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue