Exemplo n.º 1
0
        /// <summary>
        /// Shows a new <see cref="ConfirmationDialog" />.
        /// </summary>
        /// <param name="dialogHost">The <see cref="DialogHost" /></param>
        /// <param name="args">The arguments for the dialog initialization</param>
        /// <returns></returns>
        public static async Task <bool> ShowDialogAsync(DialogHost dialogHost, ConfirmationDialogArguments args)
        {
            ConfirmationDialog dialog = InitDialog(args);

            object result = await dialogHost.ShowDialog(dialog, args.OpenedHandler, args.ClosingHandler);

            return((bool)result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Shows a new <see cref="ConfirmationDialog" />.
        /// </summary>
        /// <param name="dialogHost">The <see cref="DialogHost" /></param>
        /// <param name="args">The arguments for the dialog initialization</param>
        /// <returns></returns>
        public static async Task <bool> ShowDialogAsync(DialogHost dialogHost, ConfirmationDialogArguments args)
        {
            ConfirmationDialog dialog = InitDialog(
                args.Title,
                args.Message,
                args.OkButtonLabel,
                args.CancelButtonLabel,
                args.StackedButtons
                );

            object result = await dialogHost.ShowDialog(dialog, args.OpenedHandler, args.ClosingHandler);

            return((bool)result);
        }
Exemplo n.º 3
0
        private static ConfirmationDialog InitDialog(ConfirmationDialogArguments args)
        {
            ConfirmationDialog dialog = new ConfirmationDialog
            {
                Title                 = args.Title,
                Message               = args.Message,
                StackedButtons        = args.StackedButtons,
                CustomContent         = args.CustomContent,
                CustomContentTemplate = args.CustomContentTemplate
            };

            if (!string.IsNullOrWhiteSpace(args.OkButtonLabel))
            {
                dialog.OkButtonLabel = args.OkButtonLabel;
            }

            if (!string.IsNullOrWhiteSpace(args.CancelButtonLabel))
            {
                dialog.CancelButtonLabel = args.CancelButtonLabel;
            }

            return(dialog);
        }