Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DisplayAlert.cs
3
5{
13 public class DisplayAlert(string Title, string Message, string? Accept, string? Cancel) : UiTask
14 {
18 public string Title { get; } = Title;
19
23 public string Message { get; } = Message;
24
28 public string? Accept { get; } = Accept;
29
33 public string? Cancel { get; } = Cancel;
34
38 public TaskCompletionSource<bool> CompletionSource { get; } = new TaskCompletionSource<bool>();
39
43 public override async Task Execute()
44 {
45 bool Result;
46
47 Page? DisplayedPage = App.Current?.MainPage;
48
49 if (!string.IsNullOrWhiteSpace(this.Accept) && !string.IsNullOrWhiteSpace(this.Cancel))
50 {
51 Result = await (DisplayedPage?.DisplayAlert(this.Title, this.Message, this.Accept, this.Cancel) ??
52 Task.FromResult(false));
53 }
54 else if (!string.IsNullOrWhiteSpace(this.Cancel))
55 {
56 await (DisplayedPage?.DisplayAlert(this.Title, this.Message, this.Cancel) ?? Task.CompletedTask);
57 Result = true;
58 }
59 else if (!string.IsNullOrWhiteSpace(this.Accept))
60 {
61 await (DisplayedPage?.DisplayAlert(this.Title, this.Message, this.Accept) ?? Task.CompletedTask);
62 Result = true;
63 }
64 else
65 {
66 await (DisplayedPage?.DisplayAlert(this.Title, this.Message,
67 ServiceRef.Localizer[nameof(AppResources.Ok)]) ?? Task.CompletedTask);
68
69 Result = true;
70 }
71
72 this.CompletionSource.TrySetResult(Result);
73 }
74 }
75}
Represents an instance of the Neuro-Access app.
Definition: App.xaml.cs:125
static new? App Current
Gets the current application instance.
Definition: App.xaml.cs:169
A strongly-typed resource class, for looking up localized strings, etc.
static string Ok
Looks up a localized string similar to OK.
Base class that references services in the app.
Definition: ServiceRef.cs:43
static IReportingStringLocalizer Localizer
Localization service
Definition: ServiceRef.cs:370
Abstract base class for UI tasks.
Definition: UiTask.cs:7