CsWebUiBridgeWindow<TViewModel> class

Namespace Runic.Application.Views.CsWebUi in Runic.Application.Views.CsWebUi 0.23.0-preview.1

public sealed class CsWebUiBridgeWindow<TViewModel> : IBridgeWindow, IAsyncDisposable where TViewModel : class

Inherits or implements IBridgeWindow, IAsyncDisposable.

Owns one CS-WebUI window, its DI scope, and its Bridge attachments. RunicCsWebUiHost creates it; RunicWindow.Host returns it.

Remarks

Release it with CsWebUiBridgeWindow.DisposeAsync or CsWebUiBridgeWindow.CloseAsync. There is no synchronous Dispose: accepted operations can keep the DI scope alive after the visible window closes, as with every IBridgeWindow host.

Properties

ViewModel

public TViewModel ViewModel { get; }

The window's scoped root ViewModel.

Window

public WebUiWindow Window { get; }

The underlying CS-WebUI window.

Methods

CloseAsync

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

Stops new operation admission and waits up to timeout for accepted work. A timeout closes the visible native UI and callback transport promptly, while this object retains its scope until the remaining operations finish.

Parameters

timeout

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

cancellationToken

Stops this caller's wait; the close continues.

DisposeAsync

public ValueTask DisposeAsync()

Closes the window immediately and waits until its resources are released.

WaitForCloseAsync

public ValueTask WaitForCloseAsync(CancellationToken cancellationToken = default)

Completes when CsWebUiBridgeWindow.CloseAsync or CsWebUiBridgeWindow.DisposeAsync starts closing the window, or when WebUI reports that its windows have closed.

Parameters

cancellationToken

Stops the wait without closing the window.

Remarks

CS-WebUI reports closing for all of its windows at once: with several windows open, closing one browser window does not complete this wait until the others close too. With RunicCsWebUiHost.Run the process main thread waits for WebUI and reports it; otherwise this method polls WebUiApplication.WaitAsync.