WpfBridgeView<TViewModel> class

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

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

Inherits or implements IBridgeWindow, IAsyncDisposable.

Owns one child presentation and Bridge session while borrowing an application's existing model and services.

Properties

Surface

public DesktopSurface Surface { get; }

The existing Desktop runtime surface serving this child presentation.

ViewModel

public TViewModel ViewModel { get; }

The exact application-owned model supplied during creation.

WebContent

public DesktopWebContentPolicy WebContent { get; set; }

Gets or sets what the child presentation's page may do beyond the application's origins: external navigation, downloads and developer tools. The default is DesktopWebContentPolicy.Default.

Exceptions

ArgumentNullException

The value is null.

Remarks

The next WpfBridgeView.OpenAsync applies it, as DesktopWindowOptions.WebContent; an open presentation keeps its policy.

Methods

CloseAsync

public 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.

Documentation from IBridgeWindow.CloseAsync.

DisposeAsync

public ValueTask DisposeAsync()

Releases owned presentation resources after accepted operations finish; borrowed models and services stay alive.

OpenAsync

public ValueTask OpenAsync(CancellationToken cancellationToken = default)

Opens the child presentation after its RunicWebView enters the loaded WPF visual tree.

Remarks

The presentation is always the embedded WebView2, without a browser fallback: the WPF window owns the layout, size and placement that window options would set. It applies WpfBridgeView.WebContent.

WaitForCloseAsync

public ValueTask WaitForCloseAsync(CancellationToken cancellationToken = default)

Completes when this view starts closing, including when its presentation closes.

Parameters

cancellationToken

Stops the wait without closing the view.