public sealed class RunicHostedWindow One Window of a guest application that the host shows (the Runic host protocol, runic-host/1): in a native window of the host (window mode), or in a region of one of the host's pages (region/1, RunicHostedWindow.Region).
Remarks
The host owns the window's frame, placement and activation; the guest owns its page, which the window loads from the guest's loopback address, and decides about its close. RunicHostedWindow.DesktopWindow is the native window: the host can place, present and observe it as any of its windows. A user's close, and RunicHostedWindow.RequestCloseAsync, ask the guest first; the window closes when the guest's Window has closed, and RunicHostedWindow.Closed completes.
Experimental; see docs/experimental.md.
Properties
Application
public RunicHostedApplication Application { get; } The guest application that the window belongs to.
DesktopWindow
public DesktopWindow DesktopWindow { get; } The host's native window that shows the guest's page.
Exceptions
InvalidOperationExceptionThe window has not opened yet, or it shows in a region (
RunicHostedWindow.PresentationKind), which has no native window of its own: seeRunicHostedWindow.Region.
GuardsClose
public bool GuardsClose { get; } Whether the guest decides about the window's close.
Id
public string Id { get; } The guest's id for the window, unique for the guest.
IsDocumentEdited
public bool IsDocumentEdited { get; } Whether the guest marks the Window's document as edited (set-document-edited).
IsOpen
public bool IsOpen { get; } Whether the window is open; a window in a region is open whether or not a region shows it now.
MenuBar
public IReadOnlyList<DesktopMenu> MenuBar { get; } The guest's menus that the window shows now (menus/1), as the host's policy decided them; empty when the guest has none, the policy refused them or the feature is not in use.
Remarks
A guest's item runs the guest's command, through the window's DesktopWindow.MenuCommands: choose it with DesktopWindow.TryExecuteMenuItemAsync, as the native bar and its shortcuts do. On Windows and Linux the window shows them as its own bar; on macOS they join the application menu bar while the window is key.
Owner
public RunicHostedWindow? Owner { get; } The window of the same guest that owns this one, or null.
PresentationKind
public RunicHostedWindowPresentationKind PresentationKind { get; } Whether the window shows in a native window of its own or in a region of a host page.
Region
public RunicHostedRegion? Region { get; } The region that shows the window (region/1), or null for a window of its own.
Title
public string? Title { get; } The title of the guest's page in a region (set-title), or null; in a window of its own the native window shows the page's title itself.
Type
public string Type { get; } The guest's Window type, such as MyApp.DocumentWindow`1[Report], or an empty string. Informational.
Methods
RequestCloseAsync
public ValueTask<bool> RequestCloseAsync(bool force = false, CancellationToken cancellationToken = default) Asks the guest to close the window, as the user's close does: a Window that guards its close decides first.
Parameters
forceWhether the window closes whatever the guest decides, such as when the host application quits.
cancellationTokenCancels the wait for the guest's decision; the decision may still close the window.
Returns
Whether the guest allowed the close; the window then closes once the guest's Window has, and RunicHostedWindow.Closed completes. true for a window that is already closed or whose guest has gone.