CsWebUiWindow<TViewModel> class

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

public abstract class CsWebUiWindow<TViewModel> : RunicWindow<TViewModel>, IBridgeWindow, IAsyncDisposable where TViewModel : class

Inherits or implements RunicWindow, IBridgeWindow, IAsyncDisposable.

Base class for an application Window presented by CS-WebUI. Declare one partial subclass per Window to select its root View contract:

public sealed partial class MainWindow(CsWebUiBridgeWindow<MainViewModel> host)
    : CsWebUiWindow<MainViewModel>(host);

Open it with provider.OpenWindow<MainWindow, MainViewModel>(host => new MainWindow(host)) and release it with await using or CsWebUiWindow.DisposeAsync. The members forward to CsWebUiWindow.Host, which owns the native window, its DI scope, and its Bridge attachments.

Constructors

CsWebUiWindow

protected CsWebUiWindow(CsWebUiBridgeWindow<TViewModel> host)

Creates a Window that presents host's ViewModel.

Properties

Host

public CsWebUiBridgeWindow<TViewModel> Host { get; }

The CS-WebUI host adapter for this Window.

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.

Documentation from CsWebUiBridgeWindow.CloseAsync.

DisposeAsync

public ValueTask DisposeAsync()

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

Documentation from CsWebUiBridgeWindow.DisposeAsync.

SetRootFolder

public void SetRootFolder(string path)

Inherits documentation from CsWebUiBridgeWindow.SetRootFolder.

SetSize

public void SetSize(uint width, uint height)

Inherits documentation from CsWebUiBridgeWindow.SetSize.

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.

Documentation from CsWebUiBridgeWindow.Show.

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.

Documentation from CsWebUiBridgeWindow.ShowWebView.

StartServer

public string StartServer(string content)

Inherits documentation from CsWebUiBridgeWindow.StartServer.