/// <summary> /// Output specified message with different color according to its ExtMessageBoxCategory /// </summary> /// <param name="category"></param> /// <param name="text"></param> /// <param name="caption"></param> private void Output(ExtMessageBoxCategory category, string text, string caption) { Console.ForegroundColor = getForegroundColor(category); string msg = string.Format("[{0}] : {1}", caption, text); Console.WriteLine(msg); Console.ResetColor(); }
/// <summary> /// get ForegroundColor color according to its ExtMessageBoxCategory /// </summary> /// <param name="category"></param> /// <returns></returns> private ConsoleColor getForegroundColor(ExtMessageBoxCategory category) { ConsoleColor consoleColor = ConsoleColor.White; switch (category) { case ExtMessageBoxCategory.Error: { consoleColor = ConsoleColor.Red; break; } case ExtMessageBoxCategory.Info: { consoleColor = ConsoleColor.Yellow; break; } } return consoleColor; }