Table of Contents

Interface IWebView

Namespace
VpnHood.AppUi.Hosting.WebView
Assembly
VpnHood.AppUi.Hosting.WebView.dll

Defines a platform's web view for the app's web UI: the native web view's mechanics, and what happened to it; WebViewHost decides what to do about it.

public interface IWebView

Remarks

WebViewHost calls the methods on the platform's UI thread, hopping there through Post(Action), which it calls from any thread; it expects the events on the UI thread too.

Methods

Initialize()

Creates the native web view, once; a platform may attach it to its view later, as Android after the first load, or finish making it asynchronously, as Windows.

void Initialize()

Load(Uri)

Navigates to an address, for the first load and every reload.

void Load(Uri url)

Parameters

url Uri

The address.

Exceptions

InvalidOperationException

url is relative, for a web view that reads the address's token.

Post(Action)

Runs an action on the platform's UI thread; it may be called from any thread.

void Post(Action action)

Parameters

action Action

The action.

SetLoading(bool)

Tells the web view whether the UI is loading, which a platform shows as it can: Android keeps its loading screen until the page loads, so only the end changes it.

void SetLoading(bool isLoading)

Parameters

isLoading bool

true while the UI is loading; false when the loading has ended.

ShowError(string)

Shows that the UI could not be started: a fatal error screen, or another way, as Windows' opening of the page in the browser.

void ShowError(string message)

Parameters

message string

The error's message.

Events

ContentProcessGone

Occurs when the system ended the web view's content process and the view is ready to load again, as Android after it rebuilds its web view; a platform without such a process never raises it.

event EventHandler? ContentProcessGone

Event Type

EventHandler

LoadFailed

Occurs when the main document could not be loaded.

event EventHandler? LoadFailed

Event Type

EventHandler

Remarks

It is raised for real failures only, not for a canceled or superseded load, as iOS's NSURLErrorCancelled (-999) when a new load starts over one in flight.

PageLoaded

Occurs when a navigation completed.

event EventHandler? PageLoaded

Event Type

EventHandler