Beispiel #1
0
        internal static async Task <string> CreateInputDialog(
            string title,
            string mainText,
            string subText,
            uint maxLength = int.MaxValue,
            string input   = "")
        {
            var result = await InputDialog.ShowInputDialog(
                title,
                mainText,
                input,
                subText,
                maxLength);

            if (result.Result == UserResult.Ok)
            {
                return(result.Input);
            }

            return(string.Empty);
        }
Beispiel #2
0
        public static async Task <(UserResult Result, string Input)> ShowInputDialog(string title, string message,
                                                                                     string input = "", string subMessage = "", uint maxLength = int.MaxValue)
        {
            UserResult result = UserResult.Cancel;

            InputDialog   content       = new InputDialog(message, input, subMessage, maxLength);
            ContentDialog contentDialog = new ContentDialog
            {
                Title                = title,
                PrimaryButtonText    = LocaleManager.Instance["InputDialogOk"],
                SecondaryButtonText  = "",
                CloseButtonText      = LocaleManager.Instance["InputDialogCancel"],
                Content              = content,
                PrimaryButtonCommand = MiniCommand.Create(() =>
                {
                    result = UserResult.Ok;
                    input  = content.Input;
                })
            };
            await contentDialog.ShowAsync();

            return(result, input);
        }