Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DefaultLink.cs
4
6{
10 public class DefaultLink : ILinkOpener
11 {
15 public DefaultLink()
16 {
17 }
18
24 public Grade Supports(Uri Link)
25 {
26 return Grade.Barely;
27 }
28
30 public async Task<bool> TryOpenLink(Uri Link, bool ShowErrorIfUnable)
31 {
32 bool canOpen = false;
33
34 await MainThread.InvokeOnMainThreadAsync(async () =>
35 {
36 canOpen = await Launcher.TryOpenAsync(Link);
37 });
38
39 if (canOpen)
40 return true;
41 else
42 {
43 if (ShowErrorIfUnable)
44 {
45 await ServiceRef.UiService.DisplayAlert(
46 ServiceRef.Localizer[nameof(AppResources.ErrorTitle)],
47 ServiceRef.Localizer[nameof(AppResources.QrCodeNotUnderstood)] +
48 Environment.NewLine + Environment.NewLine + Link.OriginalString);
49 }
50
51 return false;
52 }
53 }
54 }
55}
Base class that references services in the app.
Definition: ServiceRef.cs:31
static IUiService UiService
Service serializing and managing UI-related tasks.
Definition: ServiceRef.cs:55
static IStringLocalizer Localizer
Localization service
Definition: ServiceRef.cs:235
Grade
Grade enumeration
Definition: Grade.cs:7