static void Main(string[] args) { Console.OutputEncoding = Encoding.UTF8; string text = Config.Instance.PromtText; ConsoleColor color = Config.Instance.PromtColor; ConfigRouter(); while (true) { ViewHelp.Write(text, color); string request = Console.ReadLine(); try { Router.Instance.Forward(request); } catch (Exception e) { ViewHelp.WriteLine(e.Message, ConsoleColor.Red); } finally { Console.WriteLine(); } if (request.ToLower() == "quit") { break; } } }
public override void Render() { foreach (var g in Model) { ViewHelp.WriteLine($"# {g.Key}", ConsoleColor.Magenta); foreach (Book b in g) { ViewHelp.Write($"[{b.Id}] ", ConsoleColor.Yellow); ViewHelp.WriteLine(b.Title, b.Reading ? ConsoleColor.Cyan : ConsoleColor.White); } } }
/// <summary> /// In danh sách /// </summary> public override void Render() { if (Model.Length == 0) { ViewHelp.WriteLine("No book found!", ConsoleColor.Yellow); return; } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("THE BOOK LIST"); Console.ForegroundColor = ConsoleColor.Yellow; foreach (Book b in Model) { ViewHelp.Write($"[{b.Id}] ", ConsoleColor.Yellow); ViewHelp.WriteLine(b.Title, b.Reading ? ConsoleColor.Cyan : ConsoleColor.White); } ViewHelp.WriteLine($"{Model.Length} item(s)", ConsoleColor.Green); }