diff --git a/v2rayN/Directory.Packages.props b/v2rayN/Directory.Packages.props index d441b382..453c4d40 100644 --- a/v2rayN/Directory.Packages.props +++ b/v2rayN/Directory.Packages.props @@ -9,13 +9,13 @@ + - diff --git a/v2rayN/v2rayN.Desktop/Common/ButtonResult.cs b/v2rayN/v2rayN.Desktop/Common/ButtonResult.cs new file mode 100644 index 00000000..6f939d8d --- /dev/null +++ b/v2rayN/v2rayN.Desktop/Common/ButtonResult.cs @@ -0,0 +1,8 @@ +namespace v2rayN.Desktop.Common; + +public enum ButtonResult +{ + None = 0, + Yes = 1, + No = 2 +} diff --git a/v2rayN/v2rayN.Desktop/Common/UI.cs b/v2rayN/v2rayN.Desktop/Common/UI.cs index c17d8947..990e3c68 100644 --- a/v2rayN/v2rayN.Desktop/Common/UI.cs +++ b/v2rayN/v2rayN.Desktop/Common/UI.cs @@ -1,5 +1,5 @@ using Avalonia.Platform.Storage; -using MsBox.Avalonia; +using v2rayN.Desktop.Views; namespace v2rayN.Desktop.Common; @@ -9,8 +9,9 @@ internal class UI public static async Task ShowYesNo(Window owner, string msg) { - var box = MessageBoxManager.GetMessageBoxStandard(caption, msg, ButtonEnum.YesNo); - return await box.ShowWindowDialogAsync(owner); + var box = new MessageBoxDialog(caption, msg); + var result = await box.ShowDialog(owner); + return result == ButtonResult.Yes ? ButtonResult.Yes : ButtonResult.No; } public static async Task OpenFileDialog(Window owner, FilePickerFileType? filter) diff --git a/v2rayN/v2rayN.Desktop/GlobalUsings.cs b/v2rayN/v2rayN.Desktop/GlobalUsings.cs index e7499b01..5b0b2158 100644 --- a/v2rayN/v2rayN.Desktop/GlobalUsings.cs +++ b/v2rayN/v2rayN.Desktop/GlobalUsings.cs @@ -20,7 +20,6 @@ global using Avalonia.Platform; global using Avalonia.Styling; global using Avalonia.Threading; global using DynamicData; -global using MsBox.Avalonia.Enums; global using ReactiveUI; global using ReactiveUI.Avalonia; global using ReactiveUI.Fody.Helpers; diff --git a/v2rayN/v2rayN.Desktop/Views/MessageBoxDialog.axaml b/v2rayN/v2rayN.Desktop/Views/MessageBoxDialog.axaml new file mode 100644 index 00000000..dae11854 --- /dev/null +++ b/v2rayN/v2rayN.Desktop/Views/MessageBoxDialog.axaml @@ -0,0 +1,53 @@ + + + + + + + + +