改了一亿个东西,修了一亿个 BUG
This commit is contained in:
25
App.xaml.cs
25
App.xaml.cs
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
|
||||
namespace AnotherReplayReader
|
||||
@@ -12,5 +9,25 @@ namespace AnotherReplayReader
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
private int _isInException = 0;
|
||||
public App()
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) =>
|
||||
{
|
||||
if (Interlocked.Increment(ref _isInException) > 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
const string message = "哎呀呀,出现了一些无法处理的问题,只能退出了。要不要尝试保存一下日志文件呢?";
|
||||
var choice = MessageBox.Show($"{message}\r\n{eventArgs.ExceptionObject}", "自动录像机", MessageBoxButton.YesNo);
|
||||
if (choice == MessageBoxResult.Yes)
|
||||
{
|
||||
Debug.Instance.RequestSave();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user