2017-10-25 18:29:50 +02:00
|
|
|
|
using System;
|
|
|
|
|
using Windows.UI.Popups;
|
|
|
|
|
|
|
|
|
|
namespace ModernKeePass.Common
|
|
|
|
|
{
|
|
|
|
|
public static class MessageDialogHelper
|
|
|
|
|
{
|
2017-10-31 18:49:18 +01:00
|
|
|
|
public static async void ShowDeleteConfirmationDialog(string actionText, string contentText, UICommandInvokedHandler action)
|
2017-10-25 18:29:50 +02:00
|
|
|
|
{
|
|
|
|
|
// Create the message dialog and set its content
|
2017-10-31 18:49:18 +01:00
|
|
|
|
var messageDialog = new MessageDialog(contentText);
|
2017-10-25 18:29:50 +02:00
|
|
|
|
|
|
|
|
|
// Add commands and set their callbacks; both buttons use the same callback function instead of inline event handlers
|
2017-10-31 18:49:18 +01:00
|
|
|
|
messageDialog.Commands.Add(new UICommand(actionText, action));
|
2017-10-25 18:29:50 +02:00
|
|
|
|
messageDialog.Commands.Add(new UICommand("Cancel"));
|
|
|
|
|
|
|
|
|
|
// Set the command that will be invoked by default
|
|
|
|
|
messageDialog.DefaultCommandIndex = 1;
|
|
|
|
|
|
|
|
|
|
// Set the command to be invoked when escape is pressed
|
|
|
|
|
messageDialog.CancelCommandIndex = 1;
|
|
|
|
|
|
|
|
|
|
// Show the message dialog
|
|
|
|
|
await messageDialog.ShowAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|