refactor(ui): own retained controller lifetimes

This commit is contained in:
Erik 2026-07-10 23:35:26 +02:00
parent 921c388e2c
commit 5d9e98c118
21 changed files with 373 additions and 35 deletions

View file

@ -80,6 +80,16 @@ public sealed class RetailWindowManager : IDisposable
public bool TryGet(string name, out RetailWindowHandle handle)
=> _byName.TryGetValue(name, out handle!);
public void AttachController(string name, IRetainedPanelController controller)
{
ObjectDisposedException.ThrowIf(_disposed, this);
ArgumentException.ThrowIfNullOrWhiteSpace(name);
ArgumentNullException.ThrowIfNull(controller);
if (!_byName.TryGetValue(name, out var handle))
throw new KeyNotFoundException($"No retained window named '{name}' is registered.");
handle.AttachController(controller);
}
internal bool TryGet(UiElement outerFrame, out RetailWindowHandle handle)
=> _byFrame.TryGetValue(outerFrame, out handle!);