Beispiel #1
0
        /// <summary>
        /// Shows a dialog that presents the user with a message and a text box
        /// </summary>
        /// <param name="options">the options used to configure the dialog</param>
        /// <returns>a promise that resolves with the value of the text box at the time of dismissal. This promise never rejects.</returns>
        public static Promise <ConsoleString> ShowRichTextInput(RichTextDialogOptions options)
        {
            var d = Deferred <ConsoleString> .Create();

            var rawPromise = new Dialog(options).Show();

            rawPromise.Then(() => d.Resolve(options.TextBox.Value));
            return(d.Promise);
        }
Beispiel #2
0
        /// <summary>
        /// Shows a dialog that presents the user with a message and a text box
        /// </summary>
        /// <param name="options">the options used to configure the dialog</param>
        /// <returns>a Task that resolves with the value of the text box at the time of dismissal. This Task never rejects.</returns>
        public static Task <ConsoleString> ShowRichTextInput(RichTextDialogOptions options)
        {
            var d       = new TaskCompletionSource <ConsoleString>();
            var dialog  = new Dialog(options);
            var rawTask = dialog.Show();

            rawTask.Then(() => d.SetResult(dialog.WasEscapeUsedToClose ? null : options.TextBox.Value));
            return(d.Task);
        }