Publish Zonghengjia Windows 0.4.0 client source

This commit is contained in:
2026-11-29 23:48:07 +08:00
parent 308d71021e
commit 7a00f97910
37 changed files with 1722 additions and 511 deletions
+23 -32
View File
@@ -16,10 +16,9 @@ internal sealed partial class MainForm
private void UpdateConnectedTransportPresentation(bool usesTailnet)
{
_currentNodeUsesTailnet = usesTailnet;
_currentNodeName = _currentNodeBaseName is null ? null
: NodePresentation.WithTransport(_currentNodeBaseName, _currentNodeUsesTailnet);
SetTailnetTrafficVisibility(usesTailnet);
_currentNodeUsesTailnet = false;
_currentNodeName = _currentNodeBaseName is null ? null : "默认线路";
SetTailnetTrafficVisibility(false);
}
private void BuildConnectionSelection()
@@ -27,13 +26,15 @@ internal sealed partial class MainForm
ConfigureCombo(_connectionModeCombo, Point.Empty, new(130, 28));
ConfigureCombo(_manualNodeCombo, Point.Empty, new(240, 28));
_connectionModeCombo.Font = Brand.Font(8.5f);
_connectionModeCombo.AccessibleName = "连接方式(断开后可更改)";
_manualNodeCombo.AccessibleName = "手动选择授权节点(断开后可更改)";
_connectionModeCombo.Items.AddRange(["AI 自动调度", "手动选择"]);
_connectionModeCombo.AccessibleName = "已停用的旧连接选项";
_manualNodeCombo.AccessibleName = "已停用的旧线路选项";
_connectionModeCombo.Items.Add("默认线路");
_connectionModeCombo.SelectedIndex = 0;
_connectionModeCombo.SelectedIndexChanged += (_, _) => RefreshSelectionControls();
_manualNodeCombo.SelectedIndexChanged += (_, _) => RefreshSelectionControls();
_nodeCard.Controls.AddRange([_connectionModeCombo, _manualNodeCombo]);
_connectionModeCombo.Visible = false;
_manualNodeCombo.Visible = false;
RefreshSelectionControls();
}
@@ -43,10 +44,10 @@ internal sealed partial class MainForm
if (!preserveSelections) _connectionModeCombo.SelectedIndex = 0;
_manualNodeCombo.BeginUpdate();
_manualNodeCombo.Items.Clear();
_publicNodeCount = profile.Nodes.Count;
_privateAuxiliaryNodes = PrivateAuxiliaryRouting.Eligible(profile, DateTimeOffset.UtcNow);
foreach (var node in _privateAuxiliaryNodes) _manualNodeCombo.Items.Add(node);
foreach (var node in profile.Nodes) _manualNodeCombo.Items.Add(node);
var nodes = SingleNodeClientPolicy.Nodes(profile.Nodes);
_publicNodeCount = nodes.Count;
_privateAuxiliaryNodes = [];
foreach (var node in nodes) _manualNodeCombo.Items.Add(node);
_availableNodeCount = _manualNodeCombo.Items.Count;
_manualNodeCombo.SelectedItem = _manualNodeCombo.Items.Cast<NodeInfo>().FirstOrDefault(n => n.Slug == previous);
_manualNodeCombo.EndUpdate();
@@ -55,30 +56,20 @@ internal sealed partial class MainForm
private void RefreshSelectionControls()
{
var editable = !_busy && !_selectionUiConnected && !_wantConnected && !_xray.IsRunning && !_handoverOperating;
_connectionModeCombo.Enabled = editable;
_manualNodeCombo.Enabled = editable;
_manualNodeCombo.Visible = ManualSelection && editable;
_currentNodeLabel.Visible = true;
// The selector already shows AI/manual mode. Give the real connected
// node name the whole row instead of truncating it beside a duplicate badge.
var editable = !_busy && !_handoverOperating && !_switchingRouteMode;
_connectionModeCombo.Enabled = false;
_manualNodeCombo.Enabled = false;
_connectionModeCombo.Visible = false;
_manualNodeCombo.Visible = false;
_currentNodeLabel.Visible = false;
_nodeHeading.Visible = false;
_modeCard.Visible = false;
_selectionHeading.Visible = false;
_scheduleBadge.Visible = false;
_scheduleBadge.Text = ManualSelection ? "手动固定" : "AI 自动调度";
if (!_selectionUiConnected) _currentNodeLabel.Text = "未连接";
if (editable)
{
_currentNodeLabel.Text = "未连接";
if (_availableNodeCount > 0 && _statusTitle.Text == "未连接")
_statusDetail.Text = ManualSelection
? "手动选择节点后连接;不可用时不会自动换节点"
: _publicNodeCount == 0 ? "点击连接,检测已授权的私有内网节点" : "点击连接,优先尝试后台分配节点的内网入口";
}
if (_selectionUiConnected && !string.IsNullOrWhiteSpace(_currentNodeName))
_currentNodeLabel.Text = _currentNodeName;
_scheduleBadge.Text = "默认线路";
_routeCombo.Enabled = editable;
_routeCombo.Visible = true;
_routeReadOnly.Visible = true;
_routeReadOnly.Text = _selectionUiConnected ? _routeCombo.Text : "未生效";
_routeReadOnly.Visible = false;
LayoutDashboard();
}
}