mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
28 lines
1002 B
C#
28 lines
1002 B
C#
using System;
|
|
using Windows.UI.Popups;
|
|
|
|
namespace ModernKeePass.Common
|
|
{
|
|
public static class MessageDialogHelper
|
|
{
|
|
public static async void ShowDeleteConfirmationDialog(string actionText, string contentText, UICommandInvokedHandler action)
|
|
{
|
|
// Create the message dialog and set its content
|
|
var messageDialog = new MessageDialog(contentText);
|
|
|
|
// Add commands and set their callbacks; both buttons use the same callback function instead of inline event handlers
|
|
messageDialog.Commands.Add(new UICommand(actionText, action));
|
|
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();
|
|
}
|
|
}
|
|
}
|