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

41 lines
1.4 KiB
C#
Raw Normal View History

2022-12-13 07:10:18 +00:00
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
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;
string errstr = "游戏发生错误,可能是" + (string.IsNullOrWhiteSpace(CoreMOD.NowLoading) ? "游戏或者MOD" : $"MOD({CoreMOD.NowLoading})") + "导致的\n如有可能请发送 错误信息截图和引发错误之前的操作 给开发者:service@exlb.net\n感谢您对游戏开发的支持\n" + e.Exception.ToString();
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
}
}