From 691425288fedd0951613c391a7a5bda525348a45 Mon Sep 17 00:00:00 2001 From: gramps Date: Sun, 30 Aug 2026 09:11:18 -0700 Subject: [PATCH] =?UTF-8?q?refactor:=20extract=20HealthBanner=20+=20promot?= =?UTF-8?q?e=20converters=20to=20theme=20=E2=80=94=20Phase=202,=20Commit?= =?UTF-8?q?=2013?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HealthBanner.xaml takes the Row 1 YouTube-health banner (report-by-exception). Converters: promoted the 7 value<->visibility converters (BoolToVis, Inverse, NotNull, Null, Hidden, EnumToBool, AllTrueToVis) from MainWindow.Window.Resources into Themes/Controls.xaml so extracted UserControls can resolve them. AGENTS rule: controls cannot reach into a window's own named resources; they resolve from the app-level merged theme instead. Promoted all of them (not just NotNullToVis) so every pending extraction keeps working without window-level references. Zero behavior change; build 0 warnings; 246 pass, only the 2 known failures. Docs: ViewModels/index.md Phase 2 tracker updated in the same commit. --- Controls/HealthBanner.xaml | 12 ++++++++++++ Controls/HealthBanner.xaml.cs | 11 +++++++++++ MainWindow.xaml | 24 +----------------------- Themes/Controls.xaml | 14 +++++++++++++- ViewModels/index.md | 3 ++- 5 files changed, 39 insertions(+), 25 deletions(-) create mode 100644 Controls/HealthBanner.xaml create mode 100644 Controls/HealthBanner.xaml.cs diff --git a/Controls/HealthBanner.xaml b/Controls/HealthBanner.xaml new file mode 100644 index 0000000..7578add --- /dev/null +++ b/Controls/HealthBanner.xaml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/Controls/HealthBanner.xaml.cs b/Controls/HealthBanner.xaml.cs new file mode 100644 index 0000000..07c8744 --- /dev/null +++ b/Controls/HealthBanner.xaml.cs @@ -0,0 +1,11 @@ +using System.Windows.Controls; + +namespace ytLive.Controls; + +public partial class HealthBanner : UserControl +{ + public HealthBanner() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/MainWindow.xaml b/MainWindow.xaml index 4d15880..4999fbe 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -31,21 +31,6 @@ - - - - - - - - - @@ -207,14 +192,7 @@ - - - - + diff --git a/Themes/Controls.xaml b/Themes/Controls.xaml index 03f485d..ba336d4 100644 --- a/Themes/Controls.xaml +++ b/Themes/Controls.xaml @@ -1,5 +1,6 @@ + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:Helpers="clr-namespace:ytLive.Helpers"> + + + + + + + + + diff --git a/ViewModels/index.md b/ViewModels/index.md index 9017529..006ccc1 100644 --- a/ViewModels/index.md +++ b/ViewModels/index.md @@ -54,7 +54,8 @@ Progress (Commit N/12 · tag): - [x] **Phase 1 complete:** core `MainViewModel.cs` split into 10 functional partials (1,890 → 758 lines). **Phase 2 — `MainWindow.xaml` split into UserControls** (new `Controls/` folder, namespace `ytLive.Controls`): -- [x] **Commit 12 · `refactor-commit-12`** — **BottomBar** → `Controls/BottomBar.xaml(.cs)` (gear menu + stream stats + quality dropdown; `GearButton_Click` moved to the control's code-behind). Pending: TopBar, health banner, left scene/chat panel, preview pane, overlay host. +- [x] **Commit 12 · `refactor-commit-12`** — **BottomBar** → `Controls/BottomBar.xaml(.cs)` (gear menu + stream stats + quality dropdown; `GearButton_Click` moved to the control's code-behind). +- [x] **Commit 13 · `refactor-commit-13`** — **HealthBanner** → `Controls/HealthBanner.xaml` (Row 1). Also promoted the 7 value↔visibility converters out of `MainWindow.Window.Resources` into `Themes/Controls.xaml` so extracted controls can resolve them (app-level, not window-level). Pending: TopBar, left scene/chat panel, preview pane, overlay host. The partial `.cs` files land next to `MainViewModel.cs` in this folder as the split proceeds; each partial carries its own `using`s and re-declares nothing from core. \ No newline at end of file