internal static async Task <bool> ConfirmAsync(string message, string title, string confirmingText, string dismissiveText = "Cancel", MaterialAlertDialogConfiguration configuration = null)
        {
            var tcs    = new TaskCompletionSource <bool>();
            var dialog = new MaterialAlertDialog(message, title, confirmingText, dismissiveText, () => tcs.SetResult(true), () => tcs.SetResult(false), configuration)
            {
                _backgroundClicked = (s, e) =>
                {
                    tcs.SetResult(false);
                },
                _backButtonPressed = (s, e) =>
                {
                    tcs.SetResult(false);
                }
            };

            dialog.BackgroundClicked += dialog._backgroundClicked;
            dialog.BackButtonPressed += dialog._backButtonPressed;

            await dialog.ShowAsync();

            return(await tcs.Task);
        }
Exemple #2
0
 /// <summary>
 /// Shows an alert dialog for confirmation. Returns true when the confirm button was clicked, false if the dismiss button was clicked or if the alert dialog was dismissed.
 /// </summary>
 /// <param name="message">The message of the alert dialog.</param>
 /// <param name="title">The title of the alert dialog.</param>
 /// <param name="confirmingText">The text of the confirmation button.</param>
 /// <param name="dismissiveText">The text of the dismissive button</param>
 /// <param name="configuration">The style of the alert dialog.</param>
 public static async Task <bool> ShowConfirmAsync(string message, string title, string confirmingText = "Ok", string dismissiveText = "Cancel", MaterialAlertDialogConfiguration configuration = null)
 {
     return(await MaterialAlertDialog.ConfirmAsync(message, title, confirmingText, dismissiveText, configuration));
 }
Exemple #3
0
 /// <summary>
 /// Shows an alert dialog for acknowledgement. It only has a single, dismissive action used for acknowledgement.
 /// </summary>
 /// <param name="message">The message of the alert dialog.</param>
 /// <param name="title">The title of the alert dialog.</param>
 /// <param name="acknowledgementText">The text of the acknowledgement button.</param>
 /// <param name="configuration">The style of the alert dialog.</param>
 public static async Task ShowAlertAsync(string message, string title, string acknowledgementText, MaterialAlertDialogConfiguration configuration = null)
 {
     await MaterialAlertDialog.AlertAsync(message, title, acknowledgementText, configuration);
 }
Exemple #4
0
 /// <summary>
 /// Shows an alert dialog for acknowledgement. It only has a single, dismissive action used for acknowledgement.
 /// </summary>
 /// <param name="message">The message of the alert dialog.</param>
 /// <param name="configuration">The style of the alert dialog.</param>
 public static async Task ShowAlertAsync(string message, MaterialAlertDialogConfiguration configuration = null)
 {
     await MaterialAlertDialog.AlertAsync(message, configuration : configuration);
 }
 internal static async Task AlertAsync(string message, string title, string acknowledgementText = "Ok", MaterialAlertDialogConfiguration configuration = null)
 {
     var dialog = new MaterialAlertDialog(message, title, acknowledgementText, null, null, configuration: configuration);
     await dialog.ShowAsync();
 }