-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathApp.xaml.cs
34 lines (30 loc) · 1.07 KB
/
App.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Threading;
using WPFLocalizeExtension.Engine;
namespace MajdataEdit;
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
public App()
{
LocalizeDictionary.Instance.SetCurrentThreadCulture = true;
}
private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
if (e.Exception.GetType() == typeof(COMException) &&
e.Exception.Message.IndexOf("UCEERR_RENDERTHREADFAILURE") != -1)
{
// 需要开启软件渲染
MessageBox.Show(MajdataEdit.MainWindow.GetLocalizedString("SoftRenderError"),
MajdataEdit.MainWindow.GetLocalizedString("Error"));
Shutdown(114);
return;
}
MessageBox.Show(e.Exception.Source + " At:\n" + e.Exception.Message + "\n" + e.Exception.StackTrace, "发生错误",
MessageBoxButton.OK, MessageBoxImage.Error);
e.Handled = true;
}
}