RunicCloseDrain record

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

public sealed record RunicCloseDrain : IEquatable<RunicCloseDrain>

Inherits or implements IEquatable.

How long a Window stays visible after its close was decided, while its accepted work drains: its operations and awaited commands, and the AcceptedWorkScopes it drains (IRunicWindowContext.DrainOnClose). Set it with RunicWindowOptions.CloseDrain.

Remarks

With a drain, a decided close (the user's close once the Window's guards agreed, or IRunicWindowContext.RequestCloseAsync) leaves the window visible and its page connected. Operation admission stops, the pages receive closing with draining: true and keep receiving the Window's state, and operations declared RunicOperationClose.Cancel are asked to cancel. The window closes by itself when the work has ended or the drain's timeout passed. A second user close meanwhile is ignored. The drain starts only after every guard agreed, so a guard that keeps the Window open changes nothing.

No drain asks RunicOperationClose.Durable work to cancel. Operations without a declaration behave as without a drain: they are waited for, and at a timeout asked to cancel.

Runic Desktop's embedded windows, a hosted application's Windows and RunicWindowTestHost drain; a host's shutdown drains them too, within DesktopHostOptions.ShutdownDrainTimeout.

Properties

KeepWindow

public bool KeepWindow { get; }

Whether the window stays visible after a decided close: every drain but RunicCloseDrain.None.

None

public static RunicCloseDrain None { get; }

No drain: the visible window closes as soon as its close is decided, as before 0.19.

Timeout

public TimeSpan Timeout { get; }

The longest the window stays visible: TimeSpan.Zero for RunicCloseDrain.None, a positive time, or Timeout.InfiniteTimeSpan for RunicCloseDrain.UntilDrained.

UntilDrained

public static RunicCloseDrain UntilDrained { get; }

The window stays visible until its accepted work has ended, without a timeout. Only the application's own IBridgeWindow.CloseAsync or disposal, or the host's shutdown, ends it earlier.

Methods

For

public static RunicCloseDrain For(TimeSpan timeout)

The window stays visible until its accepted work has ended or timeout passed. Then operations without a declaration are asked to cancel and the visible window closes; durable work keeps the Window's scope.

Parameters

timeout

A positive time, TimeSpan.Zero (as RunicCloseDrain.None) or Timeout.InfiniteTimeSpan (as RunicCloseDrain.UntilDrained).

Exceptions

ArgumentOutOfRangeException

timeout is negative and not infinite.