VPet/VPet-Simulator.Windows/App.xaml.cs

39 lines
1.3 KiB
C#
Raw Normal View History

2023-08-12 09:58:57 +00:00
using LinePutScript.Localization.WPF;
using System.Windows;
2022-12-13 07:10:18 +00:00
namespace VPet_Simulator.Windows
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
2023-01-24 06:56:16 +00:00
public App() : base()
{
2023-01-29 08:27:24 +00:00
#if !DEBUG
2023-01-24 06:56:16 +00:00
base.DispatcherUnhandledException += App_DispatcherUnhandledException;
2023-01-29 08:27:24 +00:00
#endif
2023-01-24 06:56:16 +00:00
//AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
e.Handled = true;
2023-08-12 09:58:57 +00:00
string errstr = "游戏发生错误,可能是".Translate() + (string.IsNullOrWhiteSpace(CoreMOD.NowLoading) ?
"游戏或者MOD".Translate() : $"MOD({CoreMOD.NowLoading})") +
"导致的\n如有可能请发送 错误信息截图和引发错误之前的操作 给开发者:service@exlb.net\n感谢您对游戏开发的支持\n".Translate()
+ e.Exception.ToString();
2023-01-24 06:56:16 +00:00
if (MainWindow == null)
{
MessageBox.Show(errstr, "游戏致命性错误");
return;
}
2023-01-24 07:55:02 +00:00
else
{
new winReport(((MainWindow)MainWindow), errstr).Show();
return;
}
2023-01-24 06:56:16 +00:00
}
2022-12-13 07:10:18 +00:00
}
}