12 public class DisplayPrompt(string Title, string Message, string? Accept, string? Cancel) : UiTask
17 public string Title {
get; } = Title;
22 public string Message {
get; } = Message;
27 public string? Accept {
get; } = Accept;
32 public string? Cancel {
get; } = Cancel;
37 public TaskCompletionSource<string?> CompletionSource {
get; } =
new TaskCompletionSource<string?>();
42 public override async Task Execute()
46 Page? displayedPage = ServiceRef.UiService.PopupStack.LastOrDefault() ??
App.
Current?.MainPage;
48 if (displayedPage is
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);
58 Result = await displayedPage.DisplayPromptAsync(this.Title, this.Message,
59 ServiceRef.Localizer[nameof(AppResources.Ok)]);
62 this.CompletionSource.TrySetResult(Result);
The Application class, representing an instance of the Neuro-Access app.
static new? App Current
Gets the current application, type casted to App.