public static void Refresh(_Page Page) { Console.Clear(); CurrentPage = Page; foreach (_Line Line in Page.Contents) { if (Line is ActiveLine && CurrentLine is null) { (Line as ActiveLine).Toggle(); CurrentLine = Line; } if (CurrentLine != null && Page.Contents[Page.Contents.Count - 1].Content != (CurrentLine as ActiveLine).Description && CurrentPage.Note.Content == "") { Page.Contents[Page.Contents.Count - 1] = new StaticLine((CurrentLine as ActiveLine).Description, ConsoleColor.Blue); Refresh(Page); break; } if (Line != null) { Console.BackgroundColor = Line.Background; Console.ForegroundColor = Line.Color; Console.WriteLine(Line.Text()); } Console.ResetColor(); } }
public static void Display(_Page Page, _Line cl = null) { CurrentPage = Page; CurrentLine = cl; Refresh(Page); while (true) { var ch = Console.ReadKey(false).Key; switch (ch) { case ConsoleKey.Enter: Trigger(); break; case ConsoleKey.UpArrow: (CurrentLine as ActiveLine).Toggle(); FindNextValidLine(CurrentLine, -1); break; case ConsoleKey.DownArrow: (CurrentLine as ActiveLine).Toggle(); FindNextValidLine(CurrentLine, 1); break; } } }