diff --git a/BetterGenshinImpact/App.xaml.cs b/BetterGenshinImpact/App.xaml.cs index 864d5b4a..16c36dce 100644 --- a/BetterGenshinImpact/App.xaml.cs +++ b/BetterGenshinImpact/App.xaml.cs @@ -239,7 +239,7 @@ public partial class App : Application e = e.InnerException; } - MessageBox.Show("程序异常:" + e.Source + "\r\n--" + Environment.NewLine + e.StackTrace + "\r\n---" + Environment.NewLine + e.Message); + MessageBox.Error("程序异常:" + e.Source + "\r\n--" + Environment.NewLine + e.StackTrace + "\r\n---" + Environment.NewLine + e.Message); // log GetLogger().LogDebug(e, "UnHandle Exception"); diff --git a/BetterGenshinImpact/BetterGenshinImpact.csproj b/BetterGenshinImpact/BetterGenshinImpact.csproj index 5e1506a4..abf8d8f0 100644 --- a/BetterGenshinImpact/BetterGenshinImpact.csproj +++ b/BetterGenshinImpact/BetterGenshinImpact.csproj @@ -60,7 +60,7 @@ - + diff --git a/BetterGenshinImpact/GameTask/AutoGeniusInvokation/ScriptParser.cs b/BetterGenshinImpact/GameTask/AutoGeniusInvokation/ScriptParser.cs index 9a696d95..11fe0f92 100644 --- a/BetterGenshinImpact/GameTask/AutoGeniusInvokation/ScriptParser.cs +++ b/BetterGenshinImpact/GameTask/AutoGeniusInvokation/ScriptParser.cs @@ -95,7 +95,7 @@ public class ScriptParser catch (System.Exception ex) { MyLogger.LogError($"解析脚本错误,行号:{i + 1},错误信息:{ex}"); - MessageBox.Show($"解析脚本错误,行号:{i + 1},错误信息:{ex}", "策略解析失败", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Error($"解析脚本错误,行号:{i + 1},错误信息:{ex}", "策略解析失败"); return default!; } @@ -195,4 +195,4 @@ public class ScriptParser throw new System.Exception(msg); } } -} \ No newline at end of file +} diff --git a/BetterGenshinImpact/GameTask/AutoPick/AutoPickTrigger.cs b/BetterGenshinImpact/GameTask/AutoPick/AutoPickTrigger.cs index 45a4591e..a8482b4f 100644 --- a/BetterGenshinImpact/GameTask/AutoPick/AutoPickTrigger.cs +++ b/BetterGenshinImpact/GameTask/AutoPick/AutoPickTrigger.cs @@ -15,7 +15,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Text.Json; using System.Text.RegularExpressions; -using System.Windows.Forms; using Vanara.PInvoke; namespace BetterGenshinImpact.GameTask.AutoPick; @@ -98,7 +97,7 @@ public partial class AutoPickTrigger : ITaskTrigger catch (Exception e) { _logger.LogError(e, "读取拾取黑名单失败"); - MessageBox.Show("读取拾取黑名单失败,请确认修改后的拾取黑名单内容格式是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Error("读取拾取黑名单失败,请确认修改后的拾取黑名单内容格式是否正确!"); } try @@ -112,7 +111,7 @@ public partial class AutoPickTrigger : ITaskTrigger catch (Exception e) { _logger.LogError(e, "读取拾取白名单失败"); - MessageBox.Show("读取拾取白名单失败,请确认修改后的拾取白名单内容格式是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Error("读取拾取白名单失败,请确认修改后的拾取白名单内容格式是否正确!"); } } diff --git a/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs b/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs index 4686a3d0..c4430b8a 100644 --- a/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs +++ b/BetterGenshinImpact/GameTask/AutoSkip/AutoSkipTrigger.cs @@ -84,7 +84,7 @@ public partial class AutoSkipTrigger : ITaskTrigger catch (Exception e) { _logger.LogError(e, "读取自动剧情默认暂停点击关键词列表失败"); - MessageBox.Show("读取自动剧情默认暂停点击关键词列表失败,请确认修改后的自动剧情默认暂停点击关键词内容格式是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Error("读取自动剧情默认暂停点击关键词列表失败,请确认修改后的自动剧情默认暂停点击关键词内容格式是否正确!"); } try @@ -98,7 +98,7 @@ public partial class AutoSkipTrigger : ITaskTrigger catch (Exception e) { _logger.LogError(e, "读取自动剧情暂停点击关键词列表失败"); - MessageBox.Show("读取自动剧情暂停点击关键词列表失败,请确认修改后的自动剧情暂停点击关键词内容格式是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Error("读取自动剧情暂停点击关键词列表失败,请确认修改后的自动剧情暂停点击关键词内容格式是否正确!"); } try @@ -112,7 +112,7 @@ public partial class AutoSkipTrigger : ITaskTrigger catch (Exception e) { _logger.LogError(e, "读取自动剧情优先点击选项列表失败"); - MessageBox.Show("读取自动剧情优先点击选项列表失败,请确认修改后的自动剧情优先点击选项内容格式是否正确!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Error("读取自动剧情优先点击选项列表失败,请确认修改后的自动剧情优先点击选项内容格式是否正确!"); } } diff --git a/BetterGenshinImpact/GameTask/AutoWood/AutoWoodTask.cs b/BetterGenshinImpact/GameTask/AutoWood/AutoWoodTask.cs index ca49915a..55c7476e 100644 --- a/BetterGenshinImpact/GameTask/AutoWood/AutoWoodTask.cs +++ b/BetterGenshinImpact/GameTask/AutoWood/AutoWoodTask.cs @@ -122,7 +122,7 @@ public partial class AutoWoodTask { Logger.LogError(e.Message); Logger.LogDebug(e.StackTrace); - System.Windows.MessageBox.Show("自动伐木时异常:" + e.Source + "\r\n--" + Environment.NewLine + e.StackTrace + "\r\n---" + Environment.NewLine + e.Message); + MessageBox.Error("自动伐木时异常:" + e.Source + "\r\n--" + Environment.NewLine + e.StackTrace + "\r\n---" + Environment.NewLine + e.Message); } finally { diff --git a/BetterGenshinImpact/GameTask/Macro/QuickEnhanceArtifactMacro.cs b/BetterGenshinImpact/GameTask/Macro/QuickEnhanceArtifactMacro.cs index 27886eea..700600df 100644 --- a/BetterGenshinImpact/GameTask/Macro/QuickEnhanceArtifactMacro.cs +++ b/BetterGenshinImpact/GameTask/Macro/QuickEnhanceArtifactMacro.cs @@ -1,6 +1,6 @@ using BetterGenshinImpact.GameTask.Model.Area; using System.Threading; -using System.Windows; +using Wpf.Ui.Violeta.Controls; namespace BetterGenshinImpact.GameTask.Macro; @@ -13,7 +13,7 @@ public class QuickEnhanceArtifactMacro { if (!TaskContext.Instance().IsInitialized) { - MessageBox.Show("请先启动"); + Toast.Warning("请先启动"); return; } diff --git a/BetterGenshinImpact/GameTask/QucikBuy/QuickBuyTask.cs b/BetterGenshinImpact/GameTask/QucikBuy/QuickBuyTask.cs index c036f2ac..478bbe75 100644 --- a/BetterGenshinImpact/GameTask/QucikBuy/QuickBuyTask.cs +++ b/BetterGenshinImpact/GameTask/QucikBuy/QuickBuyTask.cs @@ -3,7 +3,7 @@ using BetterGenshinImpact.GameTask.Common; using BetterGenshinImpact.GameTask.Model.Area; using Microsoft.Extensions.Logging; using System; -using System.Windows; +using Wpf.Ui.Violeta.Controls; namespace BetterGenshinImpact.GameTask.QucikBuy; @@ -13,7 +13,7 @@ public class QuickBuyTask { if (!TaskContext.Instance().IsInitialized) { - MessageBox.Show("请先启动"); + Toast.Warning("请先启动"); return; } if (!SystemControl.IsGenshinImpactActiveByProcess()) diff --git a/BetterGenshinImpact/GameTask/QuickSereniteaPot/QuickSereniteaPotTask.cs b/BetterGenshinImpact/GameTask/QuickSereniteaPot/QuickSereniteaPotTask.cs index cf941245..3e3f895f 100644 --- a/BetterGenshinImpact/GameTask/QuickSereniteaPot/QuickSereniteaPotTask.cs +++ b/BetterGenshinImpact/GameTask/QuickSereniteaPot/QuickSereniteaPotTask.cs @@ -6,6 +6,7 @@ using BetterGenshinImpact.GameTask.QuickSereniteaPot.Assets; using BetterGenshinImpact.View.Drawable; using Microsoft.Extensions.Logging; using System; +using Wpf.Ui.Violeta.Controls; using static Vanara.PInvoke.User32; namespace BetterGenshinImpact.GameTask.QuickSereniteaPot; @@ -46,7 +47,7 @@ public class QuickSereniteaPotTask { if (!TaskContext.Instance().IsInitialized) { - System.Windows.MessageBox.Show("请先启动"); + Toast.Warning("请先启动"); return; } diff --git a/BetterGenshinImpact/GlobalUsing.cs b/BetterGenshinImpact/GlobalUsing.cs new file mode 100644 index 00000000..5a770f96 --- /dev/null +++ b/BetterGenshinImpact/GlobalUsing.cs @@ -0,0 +1 @@ +global using MessageBox = Wpf.Ui.Violeta.Controls.MessageBox; diff --git a/BetterGenshinImpact/Helpers/RuntimeHelper.cs b/BetterGenshinImpact/Helpers/RuntimeHelper.cs index 7e702613..72edb1b1 100644 --- a/BetterGenshinImpact/Helpers/RuntimeHelper.cs +++ b/BetterGenshinImpact/Helpers/RuntimeHelper.cs @@ -9,7 +9,6 @@ using System.Security.Principal; using System.Text; using System.Threading; using System.Threading.Tasks; -using System.Windows; namespace BetterGenshinImpact.Helpers; @@ -85,8 +84,7 @@ internal static class RuntimeHelper catch (Exception ex) { Debug.WriteLine(ex); - MessageBox.Show("以管理员权限启动 BetterGI 失败,非管理员权限下所有模拟操作功能均不可用!\r\n请尝试 右键 —— 以管理员身份运行 的方式启动 BetterGI", - "警告", MessageBoxButton.OK, MessageBoxImage.Warning); + MessageBox.Error("以管理员权限启动 BetterGI 失败,非管理员权限下所有模拟操作功能均不可用!\r\n请尝试 右键 —— 以管理员身份运行 的方式启动 BetterGI"); return; } } @@ -142,8 +140,7 @@ internal static class RuntimeHelper ? "请不要把主程序exe文件剪切到桌面。正确的做法:请右键点击主程序,在弹出的菜单中选择“发送到”选项,然后选择“桌面创建快捷方式”。" : "请重新安装软件"); - MessageBox.Show(stringBuilder.ToString(), - "警告", MessageBoxButton.OK, MessageBoxImage.Warning); + MessageBox.Warning(stringBuilder.ToString()); Environment.Exit(0xFFFF); } } diff --git a/BetterGenshinImpact/Helpers/WpfUiMessageBoxHelper.cs b/BetterGenshinImpact/Helpers/WpfUiMessageBoxHelper.cs deleted file mode 100644 index 994f8db4..00000000 --- a/BetterGenshinImpact/Helpers/WpfUiMessageBoxHelper.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Wpf.Ui.Controls; - -namespace BetterGenshinImpact.Helpers; - -public class WpfUiMessageBoxHelper -{ - public static void Show(string title, string content) - { - var uiMessageBox = new MessageBox - { - Title = title, - Content = content, - CloseButtonText = "确定", - }; - - uiMessageBox.ShowDialogAsync(); - } - - public static void Show(string content) - { - Show("提示", content); - } -} diff --git a/BetterGenshinImpact/View/CaptureTestWindow.xaml.cs b/BetterGenshinImpact/View/CaptureTestWindow.xaml.cs index 9c383d16..d28caa7f 100644 --- a/BetterGenshinImpact/View/CaptureTestWindow.xaml.cs +++ b/BetterGenshinImpact/View/CaptureTestWindow.xaml.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Windows; using System.Windows.Media; +using Wpf.Ui.Violeta.Controls; namespace BetterGenshinImpact.View { @@ -42,7 +43,7 @@ namespace BetterGenshinImpact.View { if (hWnd == IntPtr.Zero) { - MessageBox.Show("请选择窗口"); + Toast.Warning("请选择窗口"); return; } diff --git a/BetterGenshinImpact/ViewModel/MainWindowViewModel.cs b/BetterGenshinImpact/ViewModel/MainWindowViewModel.cs index 3b03f90f..19100ebc 100644 --- a/BetterGenshinImpact/ViewModel/MainWindowViewModel.cs +++ b/BetterGenshinImpact/ViewModel/MainWindowViewModel.cs @@ -88,7 +88,7 @@ public partial class MainWindowViewModel : ObservableObject, IViewModel } catch (Exception e) { - MessageBox.Show("PaddleOcr预热失败:" + e.Source + "\r\n--" + Environment.NewLine + e.StackTrace + "\r\n---" + Environment.NewLine + e.Message); + MessageBox.Warning("PaddleOcr预热失败:" + e.Source + "\r\n--" + Environment.NewLine + e.StackTrace + "\r\n---" + Environment.NewLine + e.Message); } try diff --git a/BetterGenshinImpact/ViewModel/Pages/HomePageViewModel.cs b/BetterGenshinImpact/ViewModel/Pages/HomePageViewModel.cs index 11a68a45..c614e8c3 100644 --- a/BetterGenshinImpact/ViewModel/Pages/HomePageViewModel.cs +++ b/BetterGenshinImpact/ViewModel/Pages/HomePageViewModel.cs @@ -152,7 +152,7 @@ public partial class HomePageViewModel : ObservableObject, INavigationAware, IVi } else { - System.Windows.MessageBox.Show("选择的窗体句柄为空!"); + MessageBox.Error("选择的窗体句柄为空!"); } } @@ -184,7 +184,7 @@ public partial class HomePageViewModel : ObservableObject, INavigationAware, IVi if (hWnd == IntPtr.Zero) { - System.Windows.MessageBox.Show("未找到原神窗口,请先启动原神!"); + MessageBox.Error("未找到原神窗口,请先启动原神!"); return; } } diff --git a/BetterGenshinImpact/ViewModel/Pages/ScriptControlViewModel.cs b/BetterGenshinImpact/ViewModel/Pages/ScriptControlViewModel.cs index 2277f248..a1c8fb92 100644 --- a/BetterGenshinImpact/ViewModel/Pages/ScriptControlViewModel.cs +++ b/BetterGenshinImpact/ViewModel/Pages/ScriptControlViewModel.cs @@ -7,7 +7,6 @@ using BetterGenshinImpact.View.Windows.Editable; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using Microsoft.Extensions.Logging; -using SharpDX.Direct3D11; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -16,6 +15,7 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Threading.Tasks; +using System.Windows; using System.Windows.Controls; using Wpf.Ui; using Wpf.Ui.Controls; @@ -195,11 +195,12 @@ public partial class ScriptControlViewModel : ObservableObject, INavigationAware public static void ShowEditWindow(object viewModel) { - var uiMessageBox = new MessageBox + var uiMessageBox = new Wpf.Ui.Controls.MessageBox { Title = "修改通用设置", Content = new ScriptGroupProjectEditor { DataContext = viewModel }, CloseButtonText = "确定", + Owner = Application.Current.MainWindow, }; uiMessageBox.ShowDialogAsync(); } diff --git a/BetterGenshinImpact/ViewModel/Pages/TaskSettingsPageViewModel.cs b/BetterGenshinImpact/ViewModel/Pages/TaskSettingsPageViewModel.cs index 4765022e..58d67374 100644 --- a/BetterGenshinImpact/ViewModel/Pages/TaskSettingsPageViewModel.cs +++ b/BetterGenshinImpact/ViewModel/Pages/TaskSettingsPageViewModel.cs @@ -13,12 +13,13 @@ using BetterGenshinImpact.View.Pages; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using System; -using System.Diagnostics; using System.IO; using System.Threading; +using System.Threading.Tasks; +using Windows.System; using Wpf.Ui; using Wpf.Ui.Controls; -using MessageBox = System.Windows.MessageBox; +using Wpf.Ui.Violeta.Controls; namespace BetterGenshinImpact.ViewModel.Pages; @@ -120,7 +121,7 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw { if (string.IsNullOrEmpty(Config.AutoGeniusInvokationConfig.StrategyName)) { - MessageBox.Show("请先选择策略"); + Toast.Warning("请先选择策略"); return; } @@ -128,7 +129,7 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw if (!File.Exists(path)) { - MessageBox.Show("策略文件不存在"); + Toast.Error("策略文件不存在"); return; } @@ -146,16 +147,16 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw } } } - catch (System.Exception ex) + catch (Exception ex) { - MessageBox.Show(ex.Message); + MessageBox.Error(ex.Message); } } [RelayCommand] - public void OnGoToAutoGeniusInvokationUrl() + public async Task OnGoToAutoGeniusInvokationUrlAsync() { - Process.Start(new ProcessStartInfo("https://bgi.huiyadan.com/doc.html#%E8%87%AA%E5%8A%A8%E4%B8%83%E5%9C%A3%E5%8F%AC%E5%94%A4") { UseShellExecute = true }); + await Launcher.LaunchUriAsync(new Uri("https://bgi.huiyadan.com/doc.html#%E8%87%AA%E5%8A%A8%E4%B8%83%E5%9C%A3%E5%8F%AC%E5%94%A4")); } [RelayCommand] @@ -180,16 +181,16 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw } } } - catch (System.Exception ex) + catch (Exception ex) { - MessageBox.Show(ex.Message); + MessageBox.Error(ex.Message); } } [RelayCommand] - public void OnGoToAutoWoodUrl() + public async Task OnGoToAutoWoodUrlAsync() { - Process.Start(new ProcessStartInfo("https://bgi.huiyadan.com/feats/felling.html") { UseShellExecute = true }); + await Launcher.LaunchUriAsync(new Uri("https://bgi.huiyadan.com/feats/felling.html")); } [RelayCommand] @@ -208,7 +209,7 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw } if (!File.Exists(path) && !Directory.Exists(path)) { - MessageBox.Show("战斗策略文件不存在"); + Toast.Error("战斗策略文件不存在"); return; } @@ -225,9 +226,9 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw } } } - catch (System.Exception ex) + catch (Exception ex) { - MessageBox.Show(ex.Message); + MessageBox.Error(ex.Message); } } @@ -236,7 +237,7 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw { if (string.IsNullOrEmpty(strategyName)) { - MessageBox.Show("请先选择战斗策略"); + Toast.Warning("请先选择战斗策略"); return null; } @@ -244,7 +245,7 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw if (!File.Exists(path)) { - MessageBox.Show("战斗策略文件不存在"); + Toast.Error("战斗策略文件不存在"); return null; } @@ -253,9 +254,9 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw } [RelayCommand] - public void OnGoToAutoFightUrl() + public async Task OnGoToAutoFightUrlAsync() { - Process.Start(new ProcessStartInfo("https://bgi.huiyadan.com/feats/domain.html") { UseShellExecute = true }); + await Launcher.LaunchUriAsync(new Uri("https://bgi.huiyadan.com/feats/domain.html")); } [RelayCommand] @@ -274,7 +275,7 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw } if (!File.Exists(path) && !Directory.Exists(path)) { - MessageBox.Show("战斗策略文件不存在"); + Toast.Error("战斗策略文件不存在"); return; } @@ -291,16 +292,16 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw } } } - catch (System.Exception ex) + catch (Exception ex) { - MessageBox.Show(ex.Message); + MessageBox.Error(ex.Message); } } [RelayCommand] - public void OnGoToAutoDomainUrl() + public async Task OnGoToAutoDomainUrlAsync() { - Process.Start(new ProcessStartInfo("https://bgi.huiyadan.com/feats/domain.html") { UseShellExecute = true }); + await Launcher.LaunchUriAsync(new Uri("https://bgi.huiyadan.com/feats/domain.html")); } [RelayCommand] @@ -325,16 +326,16 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw } } } - catch (System.Exception ex) + catch (Exception ex) { - MessageBox.Show(ex.Message); + MessageBox.Error(ex.Message); } } [RelayCommand] - public void OnGoToAutoTrackUrl() + public async Task OnGoToAutoTrackUrlAsync() { - Process.Start(new ProcessStartInfo("https://bgi.huiyadan.com/feats/track.html") { UseShellExecute = true }); + await Launcher.LaunchUriAsync(new Uri("https://bgi.huiyadan.com/feats/track.html")); } [RelayCommand] @@ -361,14 +362,14 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw } catch (Exception ex) { - MessageBox.Show(ex.Message); + MessageBox.Error(ex.Message); } } [RelayCommand] - public void OnGoToAutoTrackPathUrl() + public async Task OnGoToAutoTrackPathUrlAsync() { - Process.Start(new ProcessStartInfo("https://bgi.huiyadan.com/feats/track.html") { UseShellExecute = true }); + await Launcher.LaunchUriAsync(new Uri("https://bgi.huiyadan.com/feats/track.html")); } [RelayCommand] @@ -393,16 +394,16 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw } } } - catch (System.Exception ex) + catch (Exception ex) { - MessageBox.Show(ex.Message); + MessageBox.Error(ex.Message); } } [RelayCommand] - public void OnGoToAutoMusicGameUrl() + public async Task OnGoToAutoMusicGameUrlAsync() { - Process.Start(new ProcessStartInfo("https://bgi.huiyadan.com/feats/music.html") { UseShellExecute = true }); + await Launcher.LaunchUriAsync(new Uri("https://bgi.huiyadan.com/feats/music.html")); } public static void SetSwitchAutoTrackButtonText(bool running) diff --git a/BetterGenshinImpact/ViewModel/Windows/JsonMonoViewModel.cs b/BetterGenshinImpact/ViewModel/Windows/JsonMonoViewModel.cs index bbd24caf..3054ed85 100644 --- a/BetterGenshinImpact/ViewModel/Windows/JsonMonoViewModel.cs +++ b/BetterGenshinImpact/ViewModel/Windows/JsonMonoViewModel.cs @@ -1,5 +1,4 @@ using BetterGenshinImpact.Core.Config; -using BetterGenshinImpact.Helpers; using BetterGenshinImpact.Service; using BetterGenshinImpact.View.Windows; using CommunityToolkit.Mvvm.ComponentModel; @@ -8,6 +7,7 @@ using System; using System.Linq; using System.Text.Json; using System.Windows; +using Wpf.Ui.Violeta.Controls; namespace BetterGenshinImpact.ViewModel.Windows; @@ -28,7 +28,7 @@ public partial class JsonMonoViewModel : ObservableObject } catch (Exception e) { - WpfUiMessageBoxHelper.Show("读取黑白名单出错:" + e.ToString()); + MessageBox.Error("读取黑白名单出错:" + e.ToString()); } } @@ -41,18 +41,18 @@ public partial class JsonMonoViewModel : ObservableObject } catch (Exception e) { - WpfUiMessageBoxHelper.Show("保存失败:" + e.ToString()); + MessageBox.Error("保存失败:" + e.ToString()); return; } try { Global.WriteAllText(JsonPath, JsonText); - // WpfUiMessageBoxHelper.Show("保存成功"); + Toast.Success("保存成功"); } catch (Exception e) { - WpfUiMessageBoxHelper.Show("保存失败:" + e.ToString()); + MessageBox.Error("保存失败:" + e.ToString()); } }