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
codestringThe 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
remainingTimeSpanThe 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
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
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
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
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
byteslongThe 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
byteslongThe bytes.
Returns
- string
The words.