Exemplo n.º 1
0
        private async Task HandleDiscardChangesConfirmationAsync(InteractionContext <Unit, bool> interactionContext)
        {
            var dialog = DialogHelper.CreateAlertDialog(new AlertDialogBuilderParams()
            {
                ContentHeader    = "Confirm action",
                SupportingText   = "Are you sure to discard the changes?",
                DialogHeaderIcon = DialogIconKind.Help,
                StartupLocation  = WindowStartupLocation.CenterOwner,
                NegativeResult   = new DialogResult("no"),
                Borderless       = true,
                DialogButtons    = new[]
                {
                    new DialogResultButton
                    {
                        Content = "Yes",
                        Result  = "yes",
                    },
                    new DialogResultButton
                    {
                        Content = "No",
                        Result  = "no",
                    },
                },
            });

            var result = await dialog.ShowDialog(Host)
                         .ConfigureAwait(false);

            interactionContext.SetOutput(result.GetResult == "yes");
        }
Exemplo n.º 2
0
 public static async void ShowDialog(string header, string message, DialogIconKind icon)
 {
     var result = await DialogHelper.CreateAlertDialog(new AlertDialogBuilderParams()
     {
         ContentHeader    = header,
         SupportingText   = message,
         DialogHeaderIcon = icon,
         StartupLocation  = WindowStartupLocation.CenterOwner,
         NegativeResult   = new DialogResult("ok"),
         WindowTitle      = header,
         Borderless       = true,
         MaxWidth         = MainWindow.Instance.Width - 40,
         DialogButtons    = new DialogResultButton[]
         {
             new DialogResultButton
             {
                 Content = "OK",
                 Result  = "ok"
             }
         },
     }).ShowDialog(MainWindow.Instance);
 }