DesktopWindowPlacementExtensions class

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

public static class DesktopWindowPlacementExtensions

Converts between Runic Desktop's DesktopWindowPlacement and the RunicWindowPlacement of IRunicWindowPresentation.Placement, so a placement saved from either layer places a Window through the other.

Remarks

Both use the units of DesktopWindowState.Placement; nothing is scaled. A placement saved by Runic 0.11 or earlier on macOS is measured from the bottom-left corner (DesktopWindowPlacement.Origin is null or DesktopCoordinateOrigin.BottomLeft), which RunicWindowPlacement cannot express: pass such a placement to DesktopWindowOptions.Placement or DesktopWindow.SetPlacementAsync, which convert it once, and save the placement the window reports after.

Methods

ToDesktopPlacement

public static DesktopWindowPlacement ToDesktopPlacement(this RunicWindowPlacement placement)

Gets the DesktopWindowPlacement with the same values, measured from the top-left (DesktopCoordinateOrigin.TopLeft), as every placement Runic 0.12 and later reports.

Parameters

placement

A placement, such as IRunicWindowPresentation.Placement.

Returns

The placement for DesktopWindowOptions.Placement or DesktopWindow.SetPlacementAsync.

Exceptions

ArgumentNullException

placement is null.

ToRunicPlacement

public static RunicWindowPlacement ToRunicPlacement(this DesktopWindowPlacement placement)

Gets the RunicWindowPlacement with the same values.

Parameters

placement

A placement, such as DesktopWindowState.Placement.

Returns

The placement for IRunicWindowPresentation.SetPlacementAsync.

Exceptions

ArgumentNullException

placement is null.