Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DisplayPrompt.cs
2
4{
12 public class DisplayPrompt(string Title, string Message, string? Accept, string? Cancel) : UiTask
13 {
17 public string Title { get; } = Title;
18
22 public string Message { get; } = Message;
23
27 public string? Accept { get; } = Accept;
28
32 public string? Cancel { get; } = Cancel;
33
37 public TaskCompletionSource<string?> CompletionSource { get; } = new TaskCompletionSource<string?>();
38
42 public override async Task Execute()
43 {
44 string? Result;
45
46 Page? displayedPage = ServiceRef.UiService.PopupStack.LastOrDefault() ?? App.Current?.MainPage;
47
48 if (displayedPage is null)
49 Result = null;
50 else if (!string.IsNullOrWhiteSpace(this.Accept) && !string.IsNullOrWhiteSpace(this.Cancel))
51 Result = await displayedPage.DisplayPromptAsync(this.Title, this.Message, this.Accept, this.Cancel);
52 else if (!string.IsNullOrWhiteSpace(this.Cancel))
53 Result = await displayedPage.DisplayPromptAsync(this.Title, this.Message, this.Cancel);
54 else if (!string.IsNullOrWhiteSpace(this.Accept))
55 Result = await displayedPage.DisplayPromptAsync(this.Title, this.Message, this.Accept);
56 else
57 {
58 Result = await displayedPage.DisplayPromptAsync(this.Title, this.Message,
59 ServiceRef.Localizer[nameof(AppResources.Ok)]);
60 }
61
62 this.CompletionSource.TrySetResult(Result);
63 }
64 }
65}
The Application class, representing an instance of the Neuro-Access app.
Definition: App.xaml.cs:69
static new? App Current
Gets the current application, type casted to App.
Definition: App.xaml.cs:99