/// <summary>
        /// Displays the menu and waits for the user to choose an item.
        /// This method blocks until the user chooses an item.
        /// </summary>
        protected override void DoDisplayContent(ControlDisplay display)
        {
            bool success = false;

            while (!success && !closeWasRequested)
            {
                WriteLeftMargin();

                display.StartRow();
                string text = TextFormat == null
                    ? Text
                    : string.Format(TextFormat, Text);
                CustomConsole.Write(text);
                success = ReadUserInput();
                display.EndRow();

                WriteRightMargin();
            }
        }
Exemple #2
0
        private static void DisplayLine(ControlDisplay display, object key, object value)
        {
            display.StartRow();
            display.Write($"{key}: ");

            if (value is bool boolValue)
            {
                ConsoleColor foregroundColor = boolValue
                    ? CustomConsole.SuccessColor
                    : CustomConsole.ErrorColor;

                display.Write(foregroundColor, null, value.ToString());
            }
            else
            {
                display.Write(value.ToString());
            }

            display.EndRow();
        }