public static void DisplayPromptMessage(string message) { const int MESSAGE_BOX_TEXT_LENGTH = WINDOW_WIDTH - (2 * DISPLAY_HORIZONTAL_MARGIN); const int MESSAGE_BOX_HORIZONTAL_MARGIN = DISPLAY_HORIZONTAL_MARGIN; List <string> messageLines; messageLines = ConsoleUtilCenter.Wrap(message, MESSAGE_BOX_TEXT_LENGTH, MESSAGE_BOX_HORIZONTAL_MARGIN); for (int lineNumber = 0; lineNumber < messageLines.Count() - 1; lineNumber++) { Console.WriteLine(messageLines[lineNumber]); } Console.Write(messageLines[messageLines.Count() - 1]); }
public static void DisplayMessage(string message) { const int MESSAGE_BOX_TEXT_LENGTH = WINDOW_WIDTH - (2 * DISPLAY_HORIZONTAL_MARGIN); const int MESSAGE_BOX_HORIZONTAL_MARGIN = DISPLAY_HORIZONTAL_MARGIN; if (message != "") { List <string> messageLines; messageLines = ConsoleUtilCenter.Wrap(message, MESSAGE_BOX_TEXT_LENGTH, MESSAGE_BOX_HORIZONTAL_MARGIN); foreach (var messageLine in messageLines) { Console.WriteLine(messageLine); } } else { Console.WriteLine(); } }