CsWebUiBridgeWindow<TViewModel> class

Namespace Runic.Application.Views.CsWebUi · Runic.Application.CsWebUi 0.7.0-preview.5

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.

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

NativeWindow

public WebUiWindow NativeWindow { get; }

The underlying CS-WebUI window.

ViewModel

public TViewModel ViewModel { get; }

The window's scoped root ViewModel.

Methods

CloseAsync

public ValueTask<BridgeWindowCloseResult> CloseAsync(TimeSpan timeout)

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.

DisposeAsync

public ValueTask DisposeAsync()

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

SetPort

public void SetPort(nuint port)

Inherits documentation from WebUiWindow.SetPort, which this reference does not include.

SetRootFolder

public void SetRootFolder(string path)

Inherits documentation from WebUiWindow.SetRootFolder, which this reference does not include.

SetSize

public void SetSize(uint width, uint height)

Inherits documentation from WebUiWindow.SetSize, which this reference does not include.

Show

public void Show(string content)

Shows content with WebUI's recommended presentation: an installed browser in app mode (Chromium-based browsers first), then the system default browser, then the platform WebView.

Remarks

When the RUNIC_APPLICATION_SERVE_ONLY environment variable is 1, no browser is launched. The window starts its local server, writes RUNIC_APPLICATION_URL=<url> to standard output, and keeps serving until a line is read from standard input or the process ends. Test harnesses and remote browsers use this without changing application code.

ShowWebView

public void ShowWebView(string content)

Shows content in the platform WebView (WebView2, WebKitGTK or WKWebView) instead of a browser. The serve-only environment variable described on CsWebUiBridgeWindow.Show also applies.

StartServer

public string StartServer(string content)

Inherits documentation from WebUiWindow.StartServer, which this reference does not include.