Exemple #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);
        }
Exemple #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);
        }
Exemple #3
0
        private static ConfirmationDialog InitDialog(string title, string message, string okButtonLabel, string cancelButtonLabel, bool stackedButtons)
        {
            ConfirmationDialog dialog = new ConfirmationDialog
            {
                Title          = title,
                Message        = message,
                StackedButtons = stackedButtons
            };

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

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

            return(dialog);
        }
Exemple #4
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);
        }