Table of Contents

Class Format

Namespace
VpnHood.AppUi.Common
Assembly
VpnHood.AppUi.Common.dll

Provides the words a page composes from numbers: dates, ages, latencies and traffic.

public static class Format
Inheritance
Format
Inherited Members

Remarks

Numbers and dates follow the device's region (CurrentCulture), not the language picked in the app, as the rest of the device writes them.

Methods

CodeGroups(string)

Writes a code in groups of four, joined by dashes, as a premium code is shown.

public static string CodeGroups(string code)

Parameters

code string

The code.

Returns

string

The grouped code.

Countdown(TimeSpan)

Writes the time left as hours, minutes and seconds, as "12:34:56"; a negative time is zero.

public static string Countdown(TimeSpan remaining)

Parameters

remaining TimeSpan

The time left.

Returns

string

The words.

Latency(TimeSpan?)

Writes a latency in milliseconds, as "123 ms", or a dash for none.

public static string Latency(TimeSpan? latency)

Parameters

latency TimeSpan?

The latency, or null.

Returns

string

The words.

Price(string, double)

Writes a price as a plan lists it: the store's currency symbol, then the amount in the device's number format.

public static string Price(string currencySymbol, double amount)

Parameters

currencySymbol string

The store's currency symbol.

amount double

The amount.

Returns

string

The words.

RelativeTime(DateTime?)

Writes how long ago a time was, in the UI's words, as "3 minutes ago", or a dash for none.

public static string RelativeTime(DateTime? date)

Parameters

date DateTime?

The time, or null.

Returns

string

The words.

Exceptions

InvalidOperationException

The words have not been loaded (InitAsync(IAssetProvider, CancellationToken)).

ShortDate(DateTime?)

Writes a date as the device writes dates, in local time, or a dash for none.

public static string ShortDate(DateTime? date)

Parameters

date DateTime?

The date, or null.

Returns

string

The date's words.

Traffic(long)

Writes an amount of traffic, as "1.5 GB" or "12 MB", in the device's number format.

public static string Traffic(long bytes)

Parameters

bytes long

The bytes.

Returns

string

The words.

TrafficTight(long)

Writes an amount of traffic in the tighter form the home's circle shows, as "1.5GB".

public static string TrafficTight(long bytes)

Parameters

bytes long

The bytes.

Returns

string

The words.