Windows 0.2.22 clean UI-maintenance source delta; no private history or other platform changes

This commit is contained in:
2026-10-13 04:32:04 +00:00
parent 901f27baf5
commit 3ccaea3d52
19 changed files with 393 additions and 74 deletions
+13 -12
View File
@@ -29,22 +29,29 @@ internal sealed partial class MainForm
private readonly DashboardGlyph _trafficIcon = new(DashboardIcon.Chart), _dailyIcon = new(DashboardIcon.History);
private readonly Label _trafficHeading = new(), _dailyHeading = new();
private bool _layingOutDashboard;
private DashboardWheelRouter? _dashboardWheelRouter;
private void BuildDashboardView()
{
_dashboardView.Dock = DockStyle.Fill;
_dashboardView.BackColor = Brand.Surface;
_dashboardView.LoginArtwork = true;
_dashboardView.AutoScroll = false;
_dashboardView.Visible = false;
_dashboardView.Resize += (_, _) => LayoutDashboard();
_content.Controls.Add(_dashboardView);
_dashboardBody.BackColor = Brand.Surface;
_dashboardBody.ParentArtwork = true;
_dashboardView.Controls.Add(_dashboardBody);
_dashboardView.Controls.Add(_dashboardScrollBar);
_dashboardScrollBar.AccessibleName = "主界面垂直滚动";
_dashboardScrollBar.ValueChanged += (_, _) => _dashboardBody.Top = -_dashboardScrollBar.Value;
_dashboardView.MouseWheel += DashboardMouseWheel;
_dashboardBody.MouseWheel += DashboardMouseWheel;
_dashboardScrollBar.ValueChanged += (_, _) =>
{
_dashboardBody.Top = -_dashboardScrollBar.Value;
// Child surfaces use the viewport's fixed backdrop coordinates.
// Moving a canvas must repaint them, not bit-blit old transparent pixels.
_dashboardBody.Invalidate(true);
};
ConfigureLabel(_welcomeLabel, "", Brand.Font(15, FontStyle.Bold), Brand.Navy);
ConfigureLabel(_accountLabel, "", Brand.Font(9.5f), Brand.Muted);
ConfigureLabel(_identityBadge, "", Brand.Font(8.5f), Brand.RoyalBlue);
@@ -147,6 +154,7 @@ internal sealed partial class MainForm
}
_sessionMetric.SetBytes(0, hint: "本次连接累计");
DisplayTraffic(null, null, "仅代理流量 · 近 5 分钟");
_dashboardWheelRouter = new DashboardWheelRouter(_dashboardView, _dashboardScrollBar);
LayoutDashboard();
}
@@ -159,14 +167,6 @@ internal sealed partial class MainForm
_downloadLegend.Text = download.HasValue ? $"● 下载 {FormatBytes((long)download.Value)}/s" : "● 下载 —";
}
private void DashboardMouseWheel(object? sender, MouseEventArgs e)
{
if (!_dashboardScrollBar.Visible || e is HandledMouseEventArgs { Handled: true }) return;
var limit = Math.Max(0, _dashboardScrollBar.Maximum - _dashboardScrollBar.LargeChange + 1);
_dashboardScrollBar.Value = Math.Clamp(_dashboardScrollBar.Value - Math.Sign(e.Delta) * ScaleLogical(54), 0, limit);
if (e is HandledMouseEventArgs handled) handled.Handled = true;
}
private void LayoutDashboard()
{
if (_layingOutDashboard || _dashboardView.ClientSize.Width <= 0) return;
@@ -305,7 +305,8 @@ internal sealed partial class MainForm
checks["product_header_named_zonghengjia"] = form.Text == "纵横家" && form._brandHeader.Controls.OfType<Label>().Any(label => label.Text == "纵横家");
checks["powered_by_removed_from_login_and_footer"] = !form._footer.Controls.OfType<Label>().Concat(form._loginView.Controls.OfType<Label>())
.Any(label => label.Text.Contains("Powered by", StringComparison.OrdinalIgnoreCase) || label.Text == "优创未来");
checks["content_composes_child_painting"] = form._content.ComposeChildren;
checks["content_uses_local_buffers_not_composited_subtree"] = !form._content.ComposeChildren;
checks["dashboard_reuses_login_backdrop"] = form._dashboardView.LoginArtwork && form._dashboardBody.ParentArtwork;
checks["header_only_has_minimize_button"] = form._brandHeader.Controls.OfType<CaptionButton>().Count() == 1;
checks["scenic_asset_is_decoration_only"] = form._brandHeader.BackgroundImage is null && form._trafficChart.Parent == form._trafficCard;
checks["scenic_artwork_packaged_in_exe"] = ScenicTheme.ArtworkAvailable;