From 54ecc045b5b10a530bd33ce78e6c2222d6d1a16e Mon Sep 17 00:00:00 2001 From: DHR60 <192860629+DHR60@users.noreply.github.com> Date: Sun, 8 Nov 2026 08:00:47 +0000 Subject: [PATCH] Add HeaderContextMenu (#10547) * Add HeaderContextMenu * Up * Up --- v2rayN/ServiceLib/Handler/ConfigHandler.cs | 15 +++ .../ServiceLib/Models/Configs/ConfigItems.cs | 1 + v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 56 ++++++-- v2rayN/ServiceLib/Resx/ResUI.resx | 18 ++- v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 18 ++- .../v2rayN.Desktop/Views/ProfilesView.axaml | 61 --------- .../Views/ProfilesView.axaml.cs | 124 +++++++++++++++++- 7 files changed, 210 insertions(+), 83 deletions(-) diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index f62a9cb9..b6c9ac2f 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -102,6 +102,21 @@ public static class ConfigHandler config.UiItem ??= new(); config.UiItem.MainColumnItem ??= []; config.UiItem.WindowSizeItem ??= []; + if (config.UiItem.FrozenColumnCount == null) + { + var lvColumnItem = config.UiItem.MainColumnItem.OrderBy(t => t.Index).ToList(); + if (lvColumnItem.Count == 0 + || (lvColumnItem.Count >= 2 + && lvColumnItem[0].Name.Equals("ConfigType") + && lvColumnItem[1].Name.Equals("Remarks"))) + { + config.UiItem.FrozenColumnCount = 2; + } + else + { + config.UiItem.FrozenColumnCount = 0; + } + } if (config.UiItem.CurrentLanguage.IsNullOrEmpty()) { diff --git a/v2rayN/ServiceLib/Models/Configs/ConfigItems.cs b/v2rayN/ServiceLib/Models/Configs/ConfigItems.cs index 5d4dedb4..2747796a 100644 --- a/v2rayN/ServiceLib/Models/Configs/ConfigItems.cs +++ b/v2rayN/ServiceLib/Models/Configs/ConfigItems.cs @@ -97,6 +97,7 @@ public class UIItem public List MainColumnItem { get; set; } public List WindowSizeItem { get; set; } public bool HideColumnIpInfo { get; set; } + public int? FrozenColumnCount { get; set; } } public class ConstItem diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index 17f41af2..64b7b40f 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -996,15 +996,6 @@ namespace ServiceLib.Resx { } } - /// - /// 查找类似 Columns 的本地化字符串。 - /// - public static string menuColumns { - get { - return ResourceManager.GetString("menuColumns", resourceCulture); - } - } - /// /// 查找类似 Close Connection 的本地化字符串。 /// @@ -1041,6 +1032,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Currently frozen first {0} column(s) 的本地化字符串。 + /// + public static string menuCurrentlyFrozenColumns { + get { + return ResourceManager.GetString("menuCurrentlyFrozenColumns", resourceCulture); + } + } + /// /// 查找类似 Latency Test 的本地化字符串。 /// @@ -1185,6 +1185,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Freeze up to this column 的本地化字符串。 + /// + public static string menuFreezeToThisColumn { + get { + return ResourceManager.GetString("menuFreezeToThisColumn", resourceCulture); + } + } + /// /// 查找类似 Full Config Template Setting 的本地化字符串。 /// @@ -1230,6 +1239,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Hide this column 的本地化字符串。 + /// + public static string menuHideThisColumn { + get { + return ResourceManager.GetString("menuHideThisColumn", resourceCulture); + } + } + /// /// 查找类似 Import Rules From Clipboard 的本地化字符串。 /// @@ -1806,6 +1824,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Show columns 的本地化字符串。 + /// + public static string menuShowColumns { + get { + return ResourceManager.GetString("menuShowColumns", resourceCulture); + } + } + /// /// 查找类似 Show or hide the main window 的本地化字符串。 /// @@ -1995,6 +2022,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Unfreeze all columns 的本地化字符串。 + /// + public static string menuUnfreezeAllColumns { + get { + return ResourceManager.GetString("menuUnfreezeAllColumns", resourceCulture); + } + } + /// /// 查找类似 {0} Website 的本地化字符串。 /// @@ -4913,7 +4949,7 @@ namespace ServiceLib.Resx { return ResourceManager.GetString("TbSettingsTunAutoRoute", resourceCulture); } } - + /// /// 查找类似 DNS mode 的本地化字符串。 /// diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index 4ccbe7f4..0d3bd0c8 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -1917,8 +1917,8 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if Enter a valid IPv6 CIDR range with at least two addresses, for example fc00::/18. - - Columns + + Show columns Warp @@ -1926,4 +1926,16 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if Pre-resolve server domains - + + Freeze up to this column + + + Unfreeze all columns + + + Currently frozen first {0} column(s) + + + Hide this column + + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index 6fb8131f..f6220afc 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -1909,8 +1909,8 @@ 请输入至少包含两个地址的有效 IPv6 网段,例如 fc00::/18。 - - 列 + + 显示列 Warp @@ -1918,4 +1918,16 @@ 预解析节点域名 - + + 冻结至此列 + + + 取消所有冻结 + + + 当前已冻结前 {0} 列 + + + 隐藏此列 + + \ No newline at end of file diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml index 66b63a83..3befeae5 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml @@ -16,48 +16,6 @@ mc:Ignorable="d"> - - - - - - - - - - - - - - - - - - - - - - - - @@ -111,25 +69,6 @@ PlaceholderText="{x:Static resx:ResUI.MsgServerTitle}" ToolTip.Tip="{x:Static resx:ResUI.MsgServerTitle}" /> - - - - - - - -