IBridgeWindow interface

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

public interface IBridgeWindow : IAsyncDisposable

Inherits or implements IAsyncDisposable.

The lifetime contract shared by every Window host adapter, such as CsWebUiBridgeWindow<TViewModel> and DesktopBridgeWindow<TViewModel>. RunicWindow.Host returns the adapter of an open Window.

Remarks

Hosts release asynchronously: accepted operations may still be running when the visible window closes, and the Window's DI scope stays alive until they finish. IAsyncDisposable.DisposeAsync closes immediately and returns after every resource has been released.

Methods

CloseAsync

ValueTask<RunicWindowCloseResult> CloseAsync(TimeSpan timeout, CancellationToken cancellationToken = default)

Stops new operation admission and waits up to timeout for accepted work. At the timeout the visible window and its browser routes close promptly, while the host keeps its scope until the remaining operations finish. The first call selects the timeout; later calls return the same result.

Parameters

timeout

How long accepted operations may run before the window closes anyway.

cancellationToken

Stops this caller's wait. The close itself continues, and other callers still receive its result.

Exceptions

ArgumentOutOfRangeException

timeout is negative and not infinite.

OperationCanceledException

cancellationToken was cancelled.

WaitForCloseAsync

ValueTask WaitForCloseAsync(CancellationToken cancellationToken = default)

Completes when the window closes: the user closed it, or IBridgeWindow.CloseAsync or IAsyncDisposable.DisposeAsync started closing it. It does not release the window; dispose it afterwards.

Parameters

cancellationToken

Stops the wait without closing the window.

Exceptions

OperationCanceledException

cancellationToken was cancelled.