Windows 0.3.4 connection resilience and fixed-grid source delta; no private history or other platform changes

This commit is contained in:
2026-11-05 03:41:46 +00:00
parent aff1a50d35
commit 991b029b37
25 changed files with 629 additions and 96 deletions
+31 -25
View File
@@ -6,6 +6,7 @@ internal sealed partial class MainForm
private bool CompactPresentation => ClientSize.Width < ScaleLogical(720) || ClientSize.Height < ScaleLogical(550);
private readonly Font _compactStatusFont=Brand.Font(9.5f,FontStyle.Bold);
private readonly Font _compactChartFont=Brand.Font(7.5f);
private readonly Font _compactRowFont=Brand.Font(8f,FontStyle.Bold);
private readonly Dictionary<Control, (Font Original, Font? Compact)> _presentationFonts = new();
private bool _presentationFontsDisposed;
protected override void Dispose(bool disposing)
@@ -17,6 +18,7 @@ internal sealed partial class MainForm
_presentationFonts.Clear();
_compactStatusFont.Dispose();
_compactChartFont.Dispose();
_compactRowFont.Dispose();
}
private void SetStatusTitleFont(float size)
{
@@ -54,9 +56,9 @@ internal sealed partial class MainForm
foreach(Control control in _brandHeader.Controls)
{
if(control.Tag is not Rectangle)continue;
if(control is PictureBox)control.Bounds=new(S(10),S(5),S(34),S(37));
else if(control is Label label && label.Text=="纵横家")control.Bounds=new(S(52),S(5),S(180),S(25));
else control.Bounds=new(S(53),S(28),S(260),S(15));
if(control is PictureBox)control.Bounds=new(S(8),S(6),S(34),S(36));
else if(control is Label label && label.Text=="纵横家")control.Bounds=new(S(48),S(6),S(176),S(26));
else control.Bounds=new(S(49),S(31),S(180),S(14));
}
_headerPoem.Visible=false;
LayoutWindowChrome();
@@ -103,8 +105,9 @@ internal sealed partial class MainForm
{
_welcomeLabel.Parent=_brandHeader;
_logoutButton.Parent=_brandHeader;
_welcomeLabel.Bounds=new(_brandHeader.Width-S(226),S(5),S(172),S(20));
_logoutButton.Bounds=new(_brandHeader.Width-S(128),S(28),S(72),S(19));
var caption = _windowChrome!.MinimizeButton.Bounds;
_logoutButton.Bounds=new(caption.Left-S(72),caption.Top,S(64),caption.Height);
_welcomeLabel.Bounds=new(_logoutButton.Left-S(126),caption.Top,S(118),caption.Height);
_welcomeLabel.Visible=_logoutButton.Visible=_dashboardView.Visible;
_accountLabel.Visible=_identityBadge.Visible=false;
}
@@ -117,41 +120,44 @@ internal sealed partial class MainForm
_welcomeLabel.Visible=_logoutButton.Visible=_accountLabel.Visible=_identityBadge.Visible=true;
}
_statusDot.Bounds=R(10,4,22,22);
_connectButton.Bounds=new(_statusCard.Width-S(80),S(4),S(70),S(24));
_statusTitle.Bounds=new(S(40),S(1),_statusCard.Width-S(130),S(17));
_statusDetail.Bounds=new(S(40),S(17),_statusCard.Width-S(130),S(14));
_connectButton.Bounds=new(_statusCard.Width-S(80),S(3),S(70),S(24));
_statusTitle.Bounds=new(S(40),0,_statusCard.Width-S(130),S(16));
_statusDetail.Bounds=new(S(40),S(16),_statusCard.Width-S(130),S(13));
_nodeIcon.Visible=_modeIcon.Visible=false;
_scheduleBadge.Visible=false;
var leftWidth=_modeCard.Left-S(8);
_selectionHeading.Bounds=R(10,3,27,20);
_routeHeading.Bounds=R(10,25,27,20);
_selectionHeading.Bounds=R(10,1,27,20);
_routeHeading.Bounds=R(10,23,27,20);
_routeHeading.Text="模式";
var fieldLeft=S(38); var fieldWidth=leftWidth-fieldLeft;
var splitWidth=Math.Max(S(84),(fieldWidth-S(4))/2);
_connectionModeCombo.Bounds=new(fieldLeft,S(3),_manualNodeCombo.Visible?splitWidth:fieldWidth,S(20));
_manualNodeCombo.Bounds=new(_connectionModeCombo.Right+S(4),S(3),Math.Max(S(60),fieldWidth-splitWidth-S(4)),S(20));
_routeCombo.Bounds=new(fieldLeft,S(25),fieldWidth,S(20));
_connectionModeCombo.Bounds=new(fieldLeft,S(1),_manualNodeCombo.Visible?splitWidth:fieldWidth,S(20));
_manualNodeCombo.Bounds=new(_connectionModeCombo.Right+S(4),S(1),Math.Max(S(60),fieldWidth-splitWidth-S(4)),S(20));
_routeCombo.Bounds=new(fieldLeft,S(23),fieldWidth,S(20));
_nodeHeading.Text="节点";
_nodeHeading.Bounds=R(8,0,27,20);
_currentNodeLabel.Bounds=new(S(39),0,_modeCard.Width-S(41),S(20));
_actualModeHeading.Bounds=R(8,22,27,20);
_routeReadOnly.Bounds=new(S(39),S(22),_modeCard.Width-S(41),S(20));
_nodeHeading.Bounds=R(8,1,27,20);
_currentNodeLabel.Bounds=new(S(39),S(1),_modeCard.Width-S(41),S(20));
_actualModeHeading.Bounds=R(8,23,27,20);
_routeReadOnly.Bounds=new(S(39),S(23),_modeCard.Width-S(41),S(20));
foreach(var label in new[]{_selectionHeading,_routeHeading,_nodeHeading,_actualModeHeading,_currentNodeLabel})
{ label.TextAlign=ContentAlignment.MiddleLeft; label.Padding=Padding.Empty; }
_trafficIcon.Visible=_dailyIcon.Visible=_tailnetTrafficIcon.Visible=false;
_trafficHeading.Bounds=new(S(10),0,S(96),_trafficCard.Height-S(2));
_dailyHeading.Bounds=new(S(10),0,S(56),_dailyCard.Height-S(2));
_trafficHeading.Bounds=new(S(10),0,S(106),_trafficCard.Height-S(2));
_dailyHeading.Bounds=new(S(10),0,S(106),_dailyCard.Height-S(2));
_tailnetTrafficHeading.Text="Tailscale 速度";
_tailnetTrafficHeading.Bounds=new(S(10),0,S(96),_tailnetTrafficCard.Height-S(2));
_tailnetTrafficHeading.Bounds=new(S(10),0,S(106),_tailnetTrafficCard.Height-S(2));
foreach(var heading in new[]{_trafficHeading,_tailnetTrafficHeading,_dailyHeading})
{ heading.Font=_compactRowFont; heading.TextAlign=ContentAlignment.MiddleLeft; }
if(_tailnetTrafficVisible)
{
_tailnetUploadMetric.Bounds=_uploadMetric.Bounds;
_tailnetDownloadMetric.Bounds=_downloadMetric.Bounds;
}
var rail=CompactPresentation && _speedTrendCard.Height<S(100);
_trendHeading.Bounds=rail?R(10,6,90,20):new(S(10),S(1),_speedTrendCard.Width-S(210),S(20));
_historyRangeCombo.Bounds=rail?R(8,30,88,20):new(_speedTrendCard.Width-S(98),S(2),S(88),S(20));
_trendHeading.Bounds=new(S(10),S(2),_speedTrendCard.Width-S(120),S(20));
_trendHeading.TextAlign=ContentAlignment.MiddleLeft;
_historyRangeCombo.Bounds=new(_speedTrendCard.Width-S(98),S(2),S(88),S(20));
_trafficChart.Font=_compactChartFont;
_trafficChart.Bounds=rail?new(S(104),S(1),_speedTrendCard.Width-S(108),_speedTrendCard.Height-S(3))
:new(S(2),S(21),_speedTrendCard.Width-S(4),Math.Max(S(22),_speedTrendCard.Height-S(23)));
_trafficChart.Bounds=new(S(8),S(24),_speedTrendCard.Width-S(16),Math.Max(S(22),_speedTrendCard.Height-S(28)));
_uploadLegend.Visible=_downloadLegend.Visible=_historyStatus.Visible=false;
_sampleLabel.Visible=false;
_planLabel.Visible=false;