IRunicSidePanel interface

Namespace Runic.Application.Views in Runic.Application.Views 0.23.0

public interface IRunicSidePanel : IAsyncDisposable

Inherits or implements IAsyncDisposable.

A Window's side panel, which IRunicWindowPresentation.OpenSidePanelAsync opened: a page of the Window beside its page, on one edge by which the Window grew.

Remarks

The Window's page keeps its size and its place on the screen while the panel opens, closes, moves to the other edge or changes its width. The panel's page is a second connection of the Window and shares its ViewModel tree, so the ViewModel that opened the panel also serves it.

Disposing it closes it.

Properties

Edge

RunicSidePanelEdge Edge { get; }

Gets the edge the panel is on: RunicSidePanelEdge.Left or RunicSidePanelEdge.Right.

IsOpen

bool IsOpen { get; }

Gets whether the panel is open: false once it closed, for whatever reason.

Width

int Width { get; }

Gets the panel's width, in the units of RunicSidePanelOptions.Width.

Methods

CloseAsync

ValueTask CloseAsync(CancellationToken cancellationToken = default)

Closes the panel: its page disconnects and the Window shrinks back. Closing a closed panel does nothing.

Parameters

cancellationToken

Cancels waiting for the Window; the close itself proceeds.

Returns

A task that completes when the panel has closed.

FocusAsync

ValueTask FocusAsync(CancellationToken cancellationToken = default)

Moves the keyboard focus into the panel's page; does nothing once the panel closed.

Parameters

cancellationToken

Cancels waiting for the Window.

Returns

A task that completes when the panel has the focus.

MoveToEdgeAsync

ValueTask<RunicSidePanelRefusal?> MoveToEdgeAsync(RunicSidePanelEdge edge, CancellationToken cancellationToken = default)

Moves the panel to another edge: the Window moves by the panel's width, and its page stays where it is.

Parameters

edge

The new edge; RunicSidePanelEdge.Start and RunicSidePanelEdge.End follow the Window's layout direction.

cancellationToken

Cancels waiting for the Window.

Returns

null when the panel is on that edge now, also when it already was; otherwise why it stayed: the Window's state, room, position (RunicSidePanelRefusal.PositionUnavailable) or RunicSidePanelRefusal.Closed once the panel closed.

Exceptions

ArgumentOutOfRangeException

edge is not a defined value.

SetWidthAsync

ValueTask<RunicSidePanelRefusal?> SetWidthAsync(int width, CancellationToken cancellationToken = default)

Changes the panel's width: the Window grows or shrinks on the panel's edge by the difference.

Parameters

width

The new width, at least RunicSidePanelOptions.MinimumWidth.

cancellationToken

Cancels waiting for the Window.

Returns

null when the panel has the width now; otherwise why it kept its width, as for IRunicSidePanel.MoveToEdgeAsync.

Exceptions

ArgumentOutOfRangeException

width is smaller than RunicSidePanelOptions.MinimumWidth.

Events

Closed

event EventHandler<RunicSidePanelClosedEventArgs>? Closed

Occurs once after the panel has closed, whatever closed it, in a turn of the Window's model context.

Remarks

IRunicWindowPresentation.SidePanel is null by then. A handler added after the panel closed is not called; check IRunicSidePanel.IsOpen after adding one.