refactor(ui): own retained controller lifetimes
This commit is contained in:
parent
921c388e2c
commit
5d9e98c118
21 changed files with 373 additions and 35 deletions
|
|
@ -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!);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue