public override int PromptForChoice(string caption, string message, Collection <ChoiceDescription> choices, int defaultChoice)
        {
            this.WriteLine(ConsoleColor.Gray, ConsoleColor.Black, caption + "\n" + message + "\n");
            new Dictionary <string, PSObject>();
            string[,] array = ConsoleHostUserInterface.BuildHotkeysAndPlainLabels(choices);
            StringBuilder stringBuilder = new StringBuilder();

            for (int i = 0; i < choices.Count; i++)
            {
                stringBuilder.Append(string.Format("|{0}> {1} ", array[0, i], array[1, i]));
            }
            stringBuilder.Append(string.Format("[Default is ({0}]", array[0, defaultChoice]));
            while (true)
            {
                this.WriteLine(ConsoleColor.Gray, ConsoleColor.Black, stringBuilder.ToString());
                string text = Console.ReadLine().Trim().ToUpper(CultureInfo.CurrentCulture);
                if (text.Length == 0)
                {
                    break;
                }
                for (int j = 0; j < choices.Count; j++)
                {
                    if (array[0, j] == text)
                    {
                        return(j);
                    }
                }
                this.WriteErrorLine("Invalid choice: " + text);
            }
            return(defaultChoice);
        }
 private static string[,] BuildHotkeysAndPlainLabels(Collection <ChoiceDescription> choices)
 {
     string[,] array = new string[2, choices.Count];
     for (int i = 0; i < choices.Count; i++)
     {
         string[] hotkeyAndLabel = ConsoleHostUserInterface.GetHotkeyAndLabel(choices[i].Label);
         array[0, i] = hotkeyAndLabel[0];
         array[1, i] = hotkeyAndLabel[1];
     }
     return(array);
 }
        public override Dictionary <string, PSObject> Prompt(string caption, string message, Collection <FieldDescription> descriptions)
        {
            this.Write(ConsoleColor.Gray, ConsoleColor.Black, caption + "\n" + message + " ");
            Dictionary <string, PSObject> dictionary = new Dictionary <string, PSObject>();

            foreach (FieldDescription current in descriptions)
            {
                string[] hotkeyAndLabel = ConsoleHostUserInterface.GetHotkeyAndLabel(current.Label);
                this.WriteLine(hotkeyAndLabel[1]);
                string text = Console.ReadLine();
                if (text == null)
                {
                    return(null);
                }
                dictionary[current.Name] = PSObject.AsPSObject(text);
            }
            return(dictionary);
        }