Пример #1
0
        /// <summary>
        /// Shows a new <see cref="AlertDialog" />.
        /// </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 ShowDialogAsync(DialogHost dialogHost, AlertDialogArguments args)
        {
            AlertDialog dialog = InitDialog(
                args.Title,
                args.Message,
                args.OkButtonLabel
                );

            await dialogHost.ShowDialog(dialog, args.OpenedHandler, args.ClosingHandler);
        }
        private static AlertDialog InitDialog(AlertDialogArguments args)
        {
            AlertDialog dialog = new AlertDialog
            {
                Title                 = args.Title,
                Message               = args.Message,
                CustomContent         = args.CustomContent,
                CustomContentTemplate = args.CustomContentTemplate
            };

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

            return(dialog);
        }
        /// <summary>
        /// Shows a new <see cref="AlertDialog" />.
        /// </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 ShowDialogAsync(DialogHost dialogHost, AlertDialogArguments args)
        {
            AlertDialog dialog = InitDialog(args);

            await dialogHost.ShowDialog(dialog, args.OpenedHandler, args.ClosingHandler);
        }