feat(ui): persist retained window layouts
This commit is contained in:
parent
a8e9503d2e
commit
921c388e2c
22 changed files with 705 additions and 141 deletions
|
|
@ -36,7 +36,8 @@ public sealed class RetailWindowManager : IDisposable
|
|||
string name,
|
||||
UiElement outerFrame,
|
||||
UiElement? contentRoot = null,
|
||||
IRetainedPanelController? controller = null)
|
||||
IRetainedPanelController? controller = null,
|
||||
IRetainedWindowStateController? stateController = null)
|
||||
{
|
||||
ObjectDisposedException.ThrowIf(_disposed, this);
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(name);
|
||||
|
|
@ -46,11 +47,15 @@ public sealed class RetailWindowManager : IDisposable
|
|||
throw new InvalidOperationException(
|
||||
$"Retained window '{name}' must be mounted as a direct UiRoot child before registration.");
|
||||
|
||||
IRetainedWindowStateController? resolvedStateController =
|
||||
stateController ?? outerFrame as IRetainedWindowStateController;
|
||||
|
||||
if (_byName.TryGetValue(name, out var sameName))
|
||||
{
|
||||
if (ReferenceEquals(sameName.OuterFrame, outerFrame)
|
||||
&& ReferenceEquals(sameName.ContentRoot, contentRoot ?? outerFrame)
|
||||
&& ReferenceEquals(sameName.Controller, controller))
|
||||
&& ReferenceEquals(sameName.Controller, controller)
|
||||
&& ReferenceEquals(sameName.StateController, resolvedStateController))
|
||||
return sameName;
|
||||
|
||||
Unregister(name);
|
||||
|
|
@ -64,7 +69,8 @@ public sealed class RetailWindowManager : IDisposable
|
|||
name,
|
||||
outerFrame,
|
||||
contentRoot ?? outerFrame,
|
||||
controller);
|
||||
controller,
|
||||
resolvedStateController);
|
||||
_byName.Add(name, handle);
|
||||
_byFrame.Add(outerFrame, handle);
|
||||
handle.NotifyInitialState();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue