Table of Contents

Class VpnHoodAvaloniaAppBase

Namespace
VpnHood.AppHosting.Avalonia
Assembly
VpnHood.AppHosting.Avalonia.dll

Represents the Avalonia application a VpnHood UI derives from: one view, whatever hosts it.

public abstract class VpnHoodAvaloniaAppBase : Application, INotifyPropertyChanged, IDataContextProvider, IGlobalDataTemplates, IDataTemplateHost, IGlobalStyles, IStyleHost, IThemeVariantHost, IResourceHost, IResourceNode, IOptionalFeatureProvider
Inheritance
AvaloniaObject
Application
VpnHoodAvaloniaAppBase
Implements
IDataContextProvider
IGlobalDataTemplates
IDataTemplateHost
IGlobalStyles
IStyleHost
IThemeVariantHost
IResourceHost
IResourceNode
IOptionalFeatureProvider

Remarks

A single-view host, as Android, tvOS or a browser, gets it as the main view; a desktop host gets it in a window that cannot be resized or maximized, in the shape the UI states (WindowFit), fitted to its screen. The head gives the UI the app's API before this runs, and configures it before the view is made; the views read nothing else.

Properties

ChromeColor

Gets the colour of the system's chrome around the UI, as a desktop window's title bar or Android's system bars: the window background its theme names; or null where the UI's content names none, and the host chooses the chrome's colour.

public VhColor? ChromeColor { get; }

Property Value

VhColor?

DesktopStrings

Gets the words a desktop host shows around the UI, in the UI's language: its tray's, its taskbar button's, and its message's where it has no app to give the UI.

public abstract IDesktopStrings DesktopStrings { get; }

Property Value

IDesktopStrings

IsTvUi

Gets a value indicating whether the UI draws its TV layout: on a TV, and not as the remote a paired phone shows.

public abstract bool IsTvUi { get; }

Property Value

bool

Remarks

It can change while the app runs, as on a desktop switched into TV mode, where the UI then makes its view again; a host reads it as the view is made and as it fits the window, and never keeps it.

WindowFit

Gets the shape a desktop window takes for this UI: its layout's, which only its design knows.

public abstract DesktopWindowFitOptions WindowFit { get; }

Property Value

DesktopWindowFitOptions

Methods

CreateMainView()

Creates the UI's main view, once the head has configured the UI.

protected abstract Control CreateMainView()

Returns

Control

The view.

ImportAccessKey(string)

Imports an access key the system opened the app with, as the chosen server, and says so, or that it could not read the key, in the UI's own words.

public abstract Task ImportAccessKey(string accessKey)

Parameters

accessKey string

The access key, as a desktop launch read it from its file.

Returns

Task

A task that represents the asynchronous operation.

Remarks

It is called on the UI thread, once the view is made.

ImportAccessKeyFile(IStorageFile)

Imports an access key's file the system opened the app with, as iOS hands it over, as ImportAccessKey(string) does.

public abstract Task ImportAccessKeyFile(IStorageFile file)

Parameters

file IStorageFile

The file.

Returns

Task

A task that represents the asynchronous operation.

Remarks

It is called on the UI thread, once the view is made.

OnFrameworkInitializationCompleted()

public override void OnFrameworkInitializationCompleted()

Remarks

It gives the host's lifetime the UI's view, as that lifetime takes one; Avalonia's designer, which makes the UI with no app, gets none.

Exceptions

InvalidOperationException

The UI has the app's API but has not been configured, and the host's lifetime takes its view at once, as a desktop's or a single view's does.

QuickLaunch()

Connects as the UI's Connect button does, for a Quick Launch, as the Windows Store edition's own entry in Start, unless the app is connected or on its way.

public abstract Task QuickLaunch()

Returns

Task

A task that represents the asynchronous operation.

Remarks

It is called on the UI thread, once the view is made.

ReloadMainView()

Makes a new view in the desktop window, for what the views read only as they are made; a view in any other host stays as it is.

public void ReloadMainView()

Exceptions

InvalidOperationException

The head has not configured the UI.