From e970372a9f56b4160dbfe63c301e8a5c2b038a95 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Wed, 1 Oct 2025 16:47:22 +0800 Subject: [PATCH] Fix some minor UI bugs (#8053) --- v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 20 +++++++++---------- v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx | 6 +++--- v2rayN/ServiceLib/Resx/ResUI.hu.resx | 6 +++--- v2rayN/ServiceLib/Resx/ResUI.resx | 6 +++--- v2rayN/ServiceLib/Resx/ResUI.ru.resx | 6 +++--- v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 6 +++--- v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx | 6 +++--- .../ViewModels/DNSSettingViewModel.cs | 7 +++++++ .../Views/DNSSettingWindow.axaml | 4 +++- .../Views/DNSSettingWindow.axaml.cs | 19 +++++++++--------- .../v2rayN.Desktop/Views/SubEditWindow.axaml | 9 +++++---- v2rayN/v2rayN/Views/DNSSettingWindow.xaml | 6 +++--- v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs | 15 +++++++------- v2rayN/v2rayN/Views/SubEditWindow.xaml | 2 +- 14 files changed, 63 insertions(+), 55 deletions(-) diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index 7e848cf0..19ca4f0d 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -2913,6 +2913,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Bootstrap DNS (sing-box) 的本地化字符串。 + /// + public static string TbSBBootstrapDNS { + get { + return ResourceManager.GetString("TbSBBootstrapDNS", resourceCulture); + } + } + /// /// 查找类似 sing-box Direct Resolution Strategy 的本地化字符串。 /// @@ -2932,16 +2941,7 @@ namespace ServiceLib.Resx { } /// - /// 查找类似 sing-box DoH Resolver Server 的本地化字符串。 - /// - public static string TbSBDoHResolverServer { - get { - return ResourceManager.GetString("TbSBDoHResolverServer", resourceCulture); - } - } - - /// - /// 查找类似 Fallback DNS Resolution, Suggest IP 的本地化字符串。 + /// 查找类似 Fallback DNS Resolution, Require IP 的本地化字符串。 /// public static string TbSBFallbackDNSResolve { get { diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx index f79901eb..7be84774 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx @@ -1425,11 +1425,11 @@ Resolve Outbound Domains - - sing-box DoH Resolver Server + + Bootstrap DNS (sing-box) - Fallback DNS Resolution, Suggest IP + Fallback DNS Resolution, Require IP xray Freedom Resolution Strategy diff --git a/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayN/ServiceLib/Resx/ResUI.hu.resx index e801c796..a4701f0b 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.hu.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.hu.resx @@ -1425,11 +1425,11 @@ Resolve Outbound Domains - - sing-box DoH Resolver Server + + Bootstrap DNS (sing-box) - Fallback DNS Resolution, Suggest IP + Fallback DNS Resolution, Require IP xray Freedom Resolution Strategy diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index fc4b218f..94e03415 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -1425,11 +1425,11 @@ Resolve Outbound Domains - - sing-box DoH Resolver Server + + Bootstrap DNS (sing-box) - Fallback DNS Resolution, Suggest IP + Fallback DNS Resolution, Require IP xray Freedom Resolution Strategy diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx index 04e16eb8..c72c83cf 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx @@ -1425,11 +1425,11 @@ Разрешать домены для исходящих соединений - - Сервер DoH-резолвера (sing-box) + + Bootstrap DNS (sing-box) - Резервное DNS-разрешение (рекомендуется указывать IP) + Fallback DNS Resolution, Require IP Стратегия резолвинга Freedom (Xray) diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index ced2d74b..0d5092d0 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -1422,11 +1422,11 @@ 解析出站域名 - - sing-box DoH 解析服务器 + + Bootstrap DNS (sing-box) - 兜底解析其他 DNS 域名,建议设为 ip + 回退 DNS 解析,需指定为 IP xray freedom 解析策略 diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx index 720b7269..4ad280b0 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -1422,11 +1422,11 @@ Resolve Outbound Domains - - sing-box DoH Resolver Server + + Bootstrap DNS (sing-box) - Fallback DNS Resolution, Suggest IP + Fallback DNS Resolution, Require IP xray Freedom Resolution Strategy diff --git a/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs index 9ca2d407..4f996918 100644 --- a/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs @@ -1,4 +1,5 @@ using System.Reactive; +using System.Reactive.Linq; using ReactiveUI; using ReactiveUI.Fody.Helpers; @@ -32,6 +33,8 @@ public class DNSSettingViewModel : MyReactiveObject [Reactive] public bool RayCustomDNSEnableCompatible { get; set; } [Reactive] public bool SBCustomDNSEnableCompatible { get; set; } + [ObservableAsProperty] public bool IsSimpleDNSEnabled { get; } + public ReactiveCommand SaveCmd { get; } public ReactiveCommand ImportDefConfig4V2rayCompatibleCmd { get; } public ReactiveCommand ImportDefConfig4SingboxCompatibleCmd { get; } @@ -55,6 +58,10 @@ public class DNSSettingViewModel : MyReactiveObject await Task.CompletedTask; }); + this.WhenAnyValue(x => x.RayCustomDNSEnableCompatible, x => x.SBCustomDNSEnableCompatible) + .Select(x => !(x.Item1 && x.Item2)) + .ToPropertyEx(this, x => x.IsSimpleDNSEnabled); + _ = Init(); } diff --git a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml index d8eed12e..cfc36aec 100644 --- a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml @@ -37,6 +37,7 @@ @@ -103,7 +104,7 @@ Grid.Column="0" Margin="{StaticResource Margin4}" VerticalAlignment="Center" - Text="{x:Static resx:ResUI.TbSBDoHResolverServer}" /> + Text="{x:Static resx:ResUI.TbSBBootstrapDNS}" /> diff --git a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs index 2718df95..ce63afa0 100644 --- a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs @@ -1,4 +1,5 @@ using System.Reactive.Disposables; +using System.Reactive.Linq; using Avalonia.Controls; using Avalonia.Interactivity; using ReactiveUI; @@ -67,16 +68,14 @@ public partial class DNSSettingWindow : WindowBase this.BindCommand(ViewModel, vm => vm.ImportDefConfig4V2rayCompatibleCmd, v => v.btnImportDefConfig4V2rayCompatible).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.ImportDefConfig4SingboxCompatibleCmd, v => v.btnImportDefConfig4SingboxCompatible).DisposeWith(disposables); - this.WhenAnyValue( - x => x.ViewModel.RayCustomDNSEnableCompatible, - x => x.ViewModel.SBCustomDNSEnableCompatible, - (ray, sb) => ray && sb - ).BindTo(this.FindControl("txtBasicDNSSettingsInvalid"), t => t.IsVisible); - this.WhenAnyValue( - x => x.ViewModel.RayCustomDNSEnableCompatible, - x => x.ViewModel.SBCustomDNSEnableCompatible, - (ray, sb) => ray && sb - ).BindTo(this.FindControl("txtAdvancedDNSSettingsInvalid"), t => t.IsVisible); + this.WhenAnyValue(x => x.ViewModel.IsSimpleDNSEnabled) + .Select(b => !b) + .BindTo(this.FindControl("txtBasicDNSSettingsInvalid"), t => t.IsVisible); + this.WhenAnyValue(x => x.ViewModel.IsSimpleDNSEnabled) + .Select(b => !b) + .BindTo(this.FindControl("txtAdvancedDNSSettingsInvalid"), t => t.IsVisible); + this.Bind(ViewModel, vm => vm.IsSimpleDNSEnabled, v => v.gridBasicDNSSettings.IsEnabled).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.IsSimpleDNSEnabled, v => v.gridAdvancedDNSSettings.IsEnabled).DisposeWith(disposables); }); } diff --git a/v2rayN/v2rayN.Desktop/Views/SubEditWindow.axaml b/v2rayN/v2rayN.Desktop/Views/SubEditWindow.axaml index 7ebca48f..211cff40 100644 --- a/v2rayN/v2rayN.Desktop/Views/SubEditWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/SubEditWindow.axaml @@ -75,6 +75,7 @@ Width="{StaticResource IconButtonWidth}" Height="{StaticResource IconButtonHeight}" Margin="{StaticResource MarginLr8}" + HorizontalAlignment="Left" Theme="{DynamicResource BorderlessButton}"> @@ -208,8 +209,8 @@ Grid.Row="9" Grid.Column="2" Margin="{StaticResource Margin4}" - Content="{x:Static resx:ResUI.TbSelectProfile}" - Click="BtnSelectPrevProfile_Click" /> + Click="BtnSelectPrevProfile_Click" + Content="{x:Static resx:ResUI.TbSelectProfile}" /> + Click="BtnSelectNextProfile_Click" + Content="{x:Static resx:ResUI.TbSelectProfile}" /> - + @@ -131,7 +131,7 @@ Margin="{StaticResource Margin8}" VerticalAlignment="Center" Style="{StaticResource ToolbarTextBlock}" - Text="{x:Static resx:ResUI.TbSBDoHResolverServer}" /> + Text="{x:Static resx:ResUI.TbSBBootstrapDNS}" /> - + diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs index b5624662..d72e98bb 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs @@ -1,4 +1,5 @@ using System.Reactive.Disposables; +using System.Reactive.Linq; using System.Windows; using ReactiveUI; @@ -65,18 +66,16 @@ public partial class DNSSettingWindow this.BindCommand(ViewModel, vm => vm.ImportDefConfig4V2rayCompatibleCmd, v => v.btnImportDefConfig4V2rayCompatible).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.ImportDefConfig4SingboxCompatibleCmd, v => v.btnImportDefConfig4SingboxCompatible).DisposeWith(disposables); - this.WhenAnyValue( - x => x.ViewModel.RayCustomDNSEnableCompatible, - x => x.ViewModel.SBCustomDNSEnableCompatible, - (ray, sb) => ray && sb ? Visibility.Visible : Visibility.Collapsed) + this.WhenAnyValue(x => x.ViewModel.IsSimpleDNSEnabled) + .Select(b => b ? Visibility.Collapsed : Visibility.Visible) .BindTo(this, x => x.txtBasicDNSSettingsInvalid.Visibility) .DisposeWith(disposables); - this.WhenAnyValue( - x => x.ViewModel.RayCustomDNSEnableCompatible, - x => x.ViewModel.SBCustomDNSEnableCompatible, - (ray, sb) => ray && sb ? Visibility.Visible : Visibility.Collapsed) + this.WhenAnyValue(x => x.ViewModel.IsSimpleDNSEnabled) + .Select(b => b ? Visibility.Collapsed : Visibility.Visible) .BindTo(this, x => x.txtAdvancedDNSSettingsInvalid.Visibility) .DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.IsSimpleDNSEnabled, v => v.gridBasicDNSSettings.IsEnabled).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.IsSimpleDNSEnabled, v => v.gridAdvancedDNSSettings.IsEnabled).DisposeWith(disposables); }); WindowsUtils.SetDarkBorder(this, AppManager.Instance.Config.UiItem.CurrentTheme); } diff --git a/v2rayN/v2rayN/Views/SubEditWindow.xaml b/v2rayN/v2rayN/Views/SubEditWindow.xaml index cd665cf8..62059e60 100644 --- a/v2rayN/v2rayN/Views/SubEditWindow.xaml +++ b/v2rayN/v2rayN/Views/SubEditWindow.xaml @@ -117,7 +117,7 @@