IDesktopShowStateWindowHost interface

Namespace Runic.Desktop in Runic.Desktop 0.23.0

public interface IDesktopShowStateWindowHost : IDesktopWindowHost, IAsyncDisposable

Inherits or implements IDesktopWindowHost, IAsyncDisposable.

An optional native host that maximizes and restores its open window on request and gives it a saved placement.

Remarks

Runic Desktop finds it by type, like IDesktopBoundsWindowHost, and calls its members only when IDesktopWindowHost.Capabilities includes DesktopWindowCapabilities.Placement. Each member runs on the window's own thread and completes when the window has been asked; report the result through IDesktopWindowStateHost.StateChanged, with DesktopWindowState.Placement in the units the host applies at open (DesktopWindowHostOptions.Placement).

Runic Desktop checks the arguments and refuses a DesktopWindowOptions.Kiosk window before it calls a member. A host without it, or without the flag, makes DesktopWindow.MaximizeAsync, DesktopWindow.RestoreAsync and DesktopWindow.SetPlacementAsync fail with window-capability-unavailable.

Methods

MaximizeAsync

ValueTask MaximizeAsync(CancellationToken cancellationToken = default)

Maximizes the window; does nothing when it already is.

Parameters

cancellationToken

Cancels the queued native work.

Returns

A task that completes when the window has been asked to maximize.

Remarks

Leave full screen first and restore a minimized window maximized. A hidden window stays hidden and shows maximized.

RestoreAsync

ValueTask RestoreAsync(CancellationToken cancellationToken = default)

Returns the window to its normal bounds; does nothing when it is neither maximized, minimized nor full-screen.

Parameters

cancellationToken

Cancels the queued native work.

Returns

A task that completes when the window has been asked to restore.

Remarks

Leave full screen, un-maximize and un-minimize the window. A window minimized while it was maximized ends at its normal bounds, not maximized. A hidden window stays hidden and shows at its normal bounds.

SetPlacementAsync

ValueTask SetPlacementAsync(DesktopWindowPlacement placement, CancellationToken cancellationToken = default)

Gives the open window a placement, as DesktopWindowHostOptions.Placement gives a window that opens.

Parameters

placement

The placement, checked by Runic Desktop: DesktopWindowPlacement.X and DesktopWindowPlacement.Y both set or both null, which keeps the position, and a DesktopWindowPlacement.Width or DesktopWindowPlacement.Height of zero or less keeps that dimension.

cancellationToken

Cancels the queued native work.

Returns

A task that completes when the window has been asked to take the placement.

Remarks

Set the bounds the window restores to, also while it is maximized, minimized, full-screen or hidden, then its state. Fail with a DesktopException coded window-position-unavailable, before changing anything, for a position the toolkit cannot set.