diff --git a/src/MeoAsstGui/Bootstrapper.cs b/src/MeoAsstGui/Bootstrapper.cs index d6ca213a79..21738fc79a 100644 --- a/src/MeoAsstGui/Bootstrapper.cs +++ b/src/MeoAsstGui/Bootstrapper.cs @@ -19,6 +19,7 @@ using System.Windows; using System.Windows.Threading; using GlobalHotKey; using MeoAsstGui.MaaHotKeys; +using MeoAsstGui.Views; using Microsoft.Toolkit.Uwp.Notifications; using Stylet; using StyletIoC; @@ -121,6 +122,10 @@ namespace MeoAsstGui { // 抛异常了,可以打些日志 File.AppendAllText("gui.err.log", DateTime.Now.ToString() + ' ' + e.Exception.ToString() + '\n'); + + var errorView = new ErrorView(e.Exception.Message, e.Exception.StackTrace, true); + errorView.ShowDialog(); + errorView.Pause(); } } } diff --git a/src/MeoAsstGui/MeoAsstGui.csproj b/src/MeoAsstGui/MeoAsstGui.csproj index 08b094b361..d0dec9dea5 100644 --- a/src/MeoAsstGui/MeoAsstGui.csproj +++ b/src/MeoAsstGui/MeoAsstGui.csproj @@ -186,6 +186,7 @@ App.xaml Code + MSBuild:Compile Designer @@ -268,6 +269,7 @@ MSBuild:Compile Designer + Designer MSBuild:Compile @@ -483,6 +485,11 @@ + + + PreserveNewest + + xcopy /e /y /i /c "$(ProjectDir)..\..\3rdparty\tools" "$(TargetDir)" diff --git a/src/MeoAsstGui/Resources/Images/Warning.png b/src/MeoAsstGui/Resources/Images/Warning.png new file mode 100644 index 0000000000..428b879e7c Binary files /dev/null and b/src/MeoAsstGui/Resources/Images/Warning.png differ diff --git a/src/MeoAsstGui/Resources/Localizations/en-us.xaml b/src/MeoAsstGui/Resources/Localizations/en-us.xaml index b8e49b6615..cd86aa1162 100644 --- a/src/MeoAsstGui/Resources/Localizations/en-us.xaml +++ b/src/MeoAsstGui/Resources/Localizations/en-us.xaml @@ -331,6 +331,11 @@ The resource is damaged, please download the full package again Error + Details + Feedback + Create a GitHub issue + QQ Group + 704746719 Initialization error! Emulator resolution not supported, please set at least 720P with 16:9 ratio fails to be obtain emulator resolution . Please restart computer or consider try other emulator diff --git a/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml b/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml index e418a35441..b585108903 100644 --- a/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml +++ b/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml @@ -345,6 +345,11 @@ リソースファイルが破損しています。完全なパッケージを再度ダウンロードしてください エラー + 情報 + Feedback + Create a GitHub issue + QQ Group + 704746719 初期化エラー! エミュレータの解像度はサポートされていません。アスペクト比16:9で、720p以上に設定してください エミュレータの解像度を取得できませんでした。コンピュータを再起動するか、エミュレータを変更してから再試行することをお勧めします diff --git a/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml b/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml index 9aa283493a..2ccfd557ee 100644 --- a/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml +++ b/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml @@ -331,6 +331,11 @@ 리소스가 손상되었습니다. 전체 패키지를 다시 다운로드하십시오. 오류 + 신용 + Feedback + Create a GitHub issue + QQ Group + 704746719 초기화 오류! 에뮬레이터 해상도가 지원되지 않습니다. 해상도를 720p 이상, 16:9 으로 설정해주세요. 에뮬레이터 해상도를 가져오지 못했습니다. 컴퓨터를 다시 시작하거나 에뮬레이터를 변경한 후 다시 시도하는 것이 좋습니다. diff --git a/src/MeoAsstGui/Resources/Localizations/pallas.xaml b/src/MeoAsstGui/Resources/Localizations/pallas.xaml index 1e43924800..b18df50500 100644 --- a/src/MeoAsstGui/Resources/Localizations/pallas.xaml +++ b/src/MeoAsstGui/Resources/Localizations/pallas.xaml @@ -331,6 +331,11 @@ 🍻🍺🍺🍺🍻🍸🕺🍺🍸🕺🍺🍻🕺🕺🍺🍸🕺🍻🍻🍺 🍻🍻🕺 + 🍻🍷🍻 + 🕺🕺🕺 + 🍺🍻🕺🍺🍸🍻🕺🕺🍸🍻🍷🕺🍷🍻🍺🍷🍻🍷🍷🍻🍺🍸🍷🍷🍻🍻🍸 + 🍺🍻🕺🍸🍻 + 🍸🍷🍻💃🍺🍻🕺🍺🍻🍻 🍻🍺🍺🕺🍺🍸🍸 🍻🍻🍷🍷🍻🍸🍺🍸🍸🍸🕺💃🍷🍻🍺🍻🍺🍻🍻🍷🍺🍸🍻🍷🕺🍷🍻🍺🍷🍻🍷🍻🍻🍸🍷 🍺🍸🍷🍻🍻🍺🍸💃🍷🍸🍸🍸🍷🍸💃🍷🍸🍸🍻🍷🍸🕺🍻🍸🍸🕺🍷🍺🍷🕺 diff --git a/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml b/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml index 7a66574d36..70c1fd4d3c 100644 --- a/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml +++ b/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml @@ -331,6 +331,11 @@ 资源损坏,请重新下载完整安装包 错误 + 信息 + 反馈问题 + 创建 GitHub issue + QQ群 + 704746719 初始化错误! 模拟器分辨率不支持,请设置为 720p 或更高,且为 16:9 比例 模拟器分辨率获取失败,建议重启电脑,或更换模拟器后再次尝试 diff --git a/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml b/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml index 4767398057..87360dbe75 100644 --- a/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml +++ b/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml @@ -331,6 +331,11 @@ 資源損毀,請重新下載完整安裝包 錯誤 + 信息 + 反饋問題 + 創建 GitHub issue + QQ群 + 704746719 初始化錯誤! 模擬器解析度不支持,請設定為 720p 或更高,且為 16:9 比例 模擬器解析度獲取失敗,建議重啟電腦,或更換模擬器後再次嘗試 diff --git a/src/MeoAsstGui/Views/ErrorView.xaml b/src/MeoAsstGui/Views/ErrorView.xaml new file mode 100644 index 0000000000..a67b9a01bf --- /dev/null +++ b/src/MeoAsstGui/Views/ErrorView.xaml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MeoAsstGui/Views/ErrorView.xaml.cs b/src/MeoAsstGui/Views/ErrorView.xaml.cs new file mode 100644 index 0000000000..26a06a16f7 --- /dev/null +++ b/src/MeoAsstGui/Views/ErrorView.xaml.cs @@ -0,0 +1,61 @@ +using System; +using System.Diagnostics; +using System.Windows; +using Application = System.Windows.Forms.Application; + +namespace MeoAsstGui.Views +{ + /// + /// ErrorView.xaml 的交互逻辑 + /// + public partial class ErrorView : Window + { + protected bool ShouldExit { get; set; } + + public ErrorView() + { + InitializeComponent(); + } + + public ErrorView(string error, string details, bool shouldExit) + { + InitializeComponent(); + Title = error; + Error.Text = error; + ErrorDetails.Text = details; + ShouldExit = shouldExit; + + var isZhCn = ViewStatusStorage.Get("GUI.Localization", Localization.DefaultLanguage) == "zh-cn"; + ErrorQqGroup.Visibility = isZhCn ? Visibility.Visible : Visibility.Hidden; + ErrorQqGroupLink.Visibility = isZhCn ? Visibility.Visible : Visibility.Hidden; + } + + public void Pause() + { + while (ShouldExit) + { + Application.DoEvents(); + } + } + + protected override void OnClosed(EventArgs e) + { + if (ShouldExit) + { + Environment.Exit(0); + } + + base.OnClosed(e); + } + + private void LinkToCreateGitHubIssue_OnClick(object sender, RoutedEventArgs e) + { + Process.Start(LinkToJoinQqGroup.NavigateUri.ToString()); + } + + private void LinkToJoinQqGroup_OnClick(object sender, RoutedEventArgs e) + { + Process.Start(LinkToJoinQqGroup.NavigateUri.ToString()); + } + } +}