private static RenderLineEngine RenderLine(IUiWindow[] windows, int y, int width) { var result = new RenderLineEngine(y, width); foreach (var window in windows) { if (y >= window.Top && y < window.Top + window.Height) { var renderWindowLineEngine = new RenderWindowLineEngine(); window.Render(renderWindowLineEngine, y - window.Top, width); var line = renderWindowLineEngine.RenderLine(window); result.InsertLine(window.Left, line); } } return(result); }
private static void RenderMenu(IUiWindow window, int width) { if (window.MenuLine == null) { Console.WriteLine(new string(' ', width)); return; } foreach (var menuItem in window.MenuLine) { Console.BackgroundColor = ConsoleColor.Cyan; Console.ForegroundColor = ConsoleColor.Black; Console.Write(menuItem.FuncKey); Console.BackgroundColor = ConsoleColor.DarkCyan; // Console.ForegroundColor = ConsoleColor.White; Console.Write(menuItem.Value); Console.ResetColor(); Console.Write(" "); width = width - menuItem.FuncKey.Length - menuItem.Value.Length - 1; } var notification = UiNotifications.GetItemToShow(); if (notification != null) { RenderLineEngine.ChangeColor(notification.Background, notification.Foreground); Console.Write(notification.Text); width = width - notification.Text.Length; } if (width > 0) { Console.Write(new string(' ', width)); } }