Table of Contents

Class AvaloniaDesktopUi<TUi>

Namespace
VpnHood.AppUi.Hosting.Avalonia.Desktop
Assembly
VpnHood.AppUi.Hosting.Avalonia.Desktop.dll

Provides the Avalonia UI as a desktop head names it: the UI in AvaloniaDesktopHost's window, against whatever app the head's host hands over, or one message in its place where there is none.

public class AvaloniaDesktopUi<TUi> : IDesktopUi where TUi : Application, IAvaloniaUi, new()

Type Parameters

TUi

The UI's application.

Inheritance
AvaloniaDesktopUi<TUi>
Implements
Inherited Members

Methods

BringToFront(CancellationToken)

Asks for the window to show, as the tray's Open does.

public Task BringToFront(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Unused: the call only queues the request.

Returns

Task

A task that is already complete.

Remarks

The request goes to the UI thread, or waits for the run's start; the task does not wait for it, and the token is not read.

ImportAccessKey(string, CancellationToken)

Has the UI import an access key.

public Task ImportAccessKey(string accessKey, CancellationToken cancellationToken)

Parameters

accessKey string

The access key.

cancellationToken CancellationToken

Unused: the call only queues the request.

Returns

Task

A task that is already complete.

Remarks

The request goes to the UI thread, or waits for the run's start; the task does not wait for it, and the token is not read.

QuickLaunch(CancellationToken)

Has the UI connect, as its Connect button does.

public Task QuickLaunch(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Unused: the call only queues the request.

Returns

Task

A task that is already complete.

Remarks

The request goes to the UI thread, or waits for the run's start; the task does not wait for it, and the token is not read.

Run(DesktopUiParams, CancellationToken)

Runs the UI's window until its run ends.

public void Run(DesktopUiParams uiParams, CancellationToken cancellationToken)

Parameters

uiParams DesktopUiParams

What the window runs against, and how.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Remarks

A token canceled before the call returns at once, and one canceled later ends the run. An access key or a Quick Launch the parameters carry goes to the UI as the run starts.

Exceptions

InvalidOperationException

The parameters name no UI content store, or the UI made no main window or is not a VpnHoodAvaloniaAppBase.

OperationCanceledException

cancellationToken was canceled while the run started.

RunMessage(DesktopUiMessageParams, CancellationToken)

Runs a window with one message in the UI's place, until it is closed.

public void RunMessage(DesktopUiMessageParams messageParams, CancellationToken cancellationToken)

Parameters

messageParams DesktopUiMessageParams

The message.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Remarks

A token canceled before the call returns at once, and one canceled once the window runs ends it. Where the UI's content loads, a run only administrators may use gets the UI's own words, and the Close button the UI's word, in the device's language where the UI has it and else in English; otherwise the message is the host's text, with an English Close.