IDesktopBoundsWindowHost interface

Namespace Runic.Desktop in Runic.Desktop 0.23.0

public interface IDesktopBoundsWindowHost : IDesktopWindowHost, IAsyncDisposable

Inherits or implements IDesktopWindowHost, IAsyncDisposable.

An optional native host that moves and resizes its window in one operation and changes its minimum size while it is open.

Remarks

Runic Desktop finds it by type, like IDesktopWindowStateHost. Report DesktopWindowCapabilities.Bounds and DesktopWindowCapabilities.MinimumSize in IDesktopWindowHost.Capabilities for the operations the window supports; Runic Desktop calls a member only with its flag. With DesktopWindowCapabilities.Bounds, report DesktopWindowState.Bounds in the state in the units IDesktopBoundsWindowHost.SetBoundsAsync takes, and DesktopWindowState.VisibleBounds and DesktopWindowState.IsSnapped where the toolkit knows them.

A host without it, or without a flag, makes DesktopWindow.SetBoundsAsync and DesktopWindow.SetMinimumSizeAsync fail with window-capability-unavailable.

Methods

SetBoundsAsync

ValueTask SetBoundsAsync(DesktopWindowBounds bounds, CancellationToken cancellationToken = default)

Moves and resizes the window in one native operation, so it is never shown moved but not resized.

Parameters

bounds

The frame in the units of DesktopWindowState.Bounds, checked by Runic Desktop: a positive size, and DesktopWindowBounds.X and DesktopWindowBounds.Y both set or both null, which keeps the top-left corner where it is.

cancellationToken

Cancels the queued native work.

Returns

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

Remarks

Fail with InvalidOperationException while the window is maximized, full-screen or minimized, and with a DesktopException coded window-position-unavailable for a position the toolkit cannot set.

SetMinimumSizeAsync

ValueTask SetMinimumSizeAsync(int width, int height, CancellationToken cancellationToken = default)

Changes the window's minimum size, growing the window when it is smaller.

Parameters

width

The minimum width in the units of DesktopWindowHostOptions.MinimumWidth, or zero for none.

height

The minimum height in the units of DesktopWindowHostOptions.MinimumHeight, or zero for none.

cancellationToken

Cancels the queued native work.

Returns

A task that completes when the toolkit enforces the minimum.