From e0ae101ff4ca160c5b88ac2c642816f17ca4ce07 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:14:03 +0800 Subject: [PATCH] Adjust UI for desktop --- v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 2 +- v2rayN/ServiceLib/Resx/ResUI.resx | 2 +- v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 2 +- v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx | 2 +- .../ViewModels/StatusBarViewModel.cs | 17 -- v2rayN/v2rayN.Desktop/App.axaml | 26 +-- v2rayN/v2rayN.Desktop/Common/UI.cs | 26 +-- .../Views/OptionSettingWindow.axaml | 180 +++++++++--------- .../Views/RoutingRuleDetailsWindow.axaml | 4 +- v2rayN/v2rayN/Views/OptionSettingWindow.xaml | 172 +++++++++-------- 10 files changed, 200 insertions(+), 233 deletions(-) diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index d0422079..abe53603 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -1348,7 +1348,7 @@ namespace ServiceLib.Resx { } /// - /// 查找类似 Import Advanced Rules 的本地化字符串。 + /// 查找类似 Import Rules 的本地化字符串。 /// public static string menuRoutingAdvancedImportRules { get { diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index 96a78013..82b27147 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -842,7 +842,7 @@ Add - Import Advanced Rules + Import Rules Remove selected (Delete) diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index 18a5f149..6807b6de 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -842,7 +842,7 @@ 添加规则集 - 一键导入高级规则 + 一键导入规则集 移除所选规则 (Delete) diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx index 15baf315..27d7207b 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -843,7 +843,7 @@ 新增規則集 - 一鍵匯入進階規則 + 一鍵匯入規則集 移除所選規則 (Delete) diff --git a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs index a2b89a9d..80e3f287 100644 --- a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs @@ -48,18 +48,6 @@ namespace ServiceLib.ViewModels [Reactive] public bool BlSystemProxyPac { get; set; } - [Reactive] - public bool BlNotSystemProxyClear { get; set; } - - [Reactive] - public bool BlNotSystemProxySet { get; set; } - - [Reactive] - public bool BlNotSystemProxyNothing { get; set; } - - [Reactive] - public bool BlNotSystemProxyPac { get; set; } - public ReactiveCommand SystemProxyClearCmd { get; } public ReactiveCommand SystemProxySetCmd { get; } public ReactiveCommand SystemProxyNothingCmd { get; } @@ -333,11 +321,6 @@ namespace ServiceLib.ViewModels BlSystemProxyNothing = (type == ESysProxyType.Unchanged); BlSystemProxyPac = (type == ESysProxyType.Pac); - BlNotSystemProxyClear = !BlSystemProxyClear; - BlNotSystemProxySet = !BlSystemProxySet; - BlNotSystemProxyNothing = !BlSystemProxyNothing; - BlNotSystemProxyPac = !BlSystemProxyPac; - if (blChange) { _updateView?.Invoke(EViewAction.DispatcherRefreshIcon, null); diff --git a/v2rayN/v2rayN.Desktop/App.axaml b/v2rayN/v2rayN.Desktop/App.axaml index 6a9d7d51..7428d63d 100644 --- a/v2rayN/v2rayN.Desktop/App.axaml +++ b/v2rayN/v2rayN.Desktop/App.axaml @@ -32,32 +32,18 @@ - - + IsChecked="{Binding BlSystemProxyClear}" + ToggleType="Radio" /> - - + IsChecked="{Binding BlSystemProxySet}" + ToggleType="Radio" /> - + IsChecked="{Binding BlSystemProxyNothing}" + ToggleType="Radio" /> diff --git a/v2rayN/v2rayN.Desktop/Common/UI.cs b/v2rayN/v2rayN.Desktop/Common/UI.cs index 0f72c55a..74cfa6eb 100644 --- a/v2rayN/v2rayN.Desktop/Common/UI.cs +++ b/v2rayN/v2rayN.Desktop/Common/UI.cs @@ -17,13 +17,11 @@ namespace v2rayN.Desktop.Common public static async Task OpenFileDialog(Window owner, FilePickerFileType? filter) { - var topLevel = TopLevel.GetTopLevel(owner); - if (topLevel == null) - { - return null; - } + var sp = GetStorageProvider(owner); + if (sp is null) return null; + // Start async operation to open the dialog. - var files = await topLevel.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions + var files = await sp.OpenFilePickerAsync(new FilePickerOpenOptions { AllowMultiple = false, FileTypeFilter = filter is null ? [FilePickerFileTypes.All, FilePickerFileTypes.ImagePng] : [filter] @@ -34,17 +32,21 @@ namespace v2rayN.Desktop.Common public static async Task SaveFileDialog(Window owner, string filter) { - var topLevel = TopLevel.GetTopLevel(owner); - if (topLevel == null) - { - return null; - } + var sp = GetStorageProvider(owner); + if (sp is null) return null; + // Start async operation to open the dialog. - var files = await topLevel.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions + var files = await sp.SaveFilePickerAsync(new FilePickerSaveOptions { }); return files?.TryGetLocalPath(); } + + private static IStorageProvider? GetStorageProvider(Window owner) + { + var topLevel = TopLevel.GetTopLevel(owner); + return topLevel?.StorageProvider; + } } } \ No newline at end of file diff --git a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml index b240ed4b..890e6702 100644 --- a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml @@ -115,7 +115,7 @@ HorizontalAlignment="Left" Classes="Margin8" SelectionMode="Multiple" - Theme="{DynamicResource PureCardRadioGroupListBox}" /> + Theme="{DynamicResource CardCheckGroupListBox}" /> - - + + + Text="Strict Route" /> + - - + + - - + + - - + + - - + + - - - - - - - - + + + + diff --git a/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml b/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml index b3c47105..62cdd0bf 100644 --- a/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml @@ -95,7 +95,7 @@ HorizontalAlignment="Left" Classes="Margin8" SelectionMode="Multiple" - Theme="{DynamicResource PureCardRadioGroupListBox}" /> + Theme="{DynamicResource CardCheckGroupListBox}" /> + Theme="{DynamicResource CardCheckGroupListBox}" /> - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - - - + + +