public override void ControllPos() { base.ControllPos(); if (Page < 0) { Page = 0; } if (Page > Content.Count / ConsoleHelpers.GetMaxStrings()) { Page = Content.Count / ConsoleHelpers.GetMaxStrings(); } }
void PrintPagesCount() { CursorControl.AddWindowPosition(Console.WindowHeight - 3); if (mc.manager.MainMenu.Content.Count % ConsoleHelpers.GetMaxStrings() == 0) { Console.Write($"Page - {(mc.manager.MainMenu as PageMenu).Page + 1}/" + $"{ mc.manager.MainMenu.Content.Count / ConsoleHelpers.GetMaxStrings()}"); } else { Console.Write($"Page - {(mc.manager.MainMenu as PageMenu).Page + 1}/" + $"{ mc.manager.MainMenu.Content.Count / ConsoleHelpers.GetMaxStrings() + 1}"); } }
public void Display() { if (!mc.NoNeedScreenUpdate || (mc.manager.MainMenu as PageMenu).Scrolled) { displayableDates = new List <string>(); displayableNames = new List <string>(); displayableSizes = new List <string>(); List <FileSystemInfo> displayableContent; if (mc.manager.MainMenu.Content.Count > ConsoleHelpers.GetMaxStrings()) { displayableContent = mc.manager.MainMenu.Content.LeaveRange((mc.manager.MainMenu as PageMenu).Page * ConsoleHelpers.GetMaxStrings(), ((mc.manager.MainMenu as PageMenu).Page + 1) * ConsoleHelpers.GetMaxStrings()); } else { displayableContent = mc.manager.MainMenu.Content; } foreach (var fsi in displayableContent) { displayableNames.Add(fsi.Name); displayableDates.Add(fsi.LastWriteTime.ToString()); displayableSizes.Add(fsi.ToFileInfo().GetSize()); } backGroundPrinter.BackGround(); if (mc.manager.MainMenu.Content.Count > 0) { PrintMain(); PrintProperties(); } PrintAdd(); PrintPagesCount(); PrintPath(); (mc.manager.MainMenu as PageMenu).Scrolled = false; } else { if (mc.manager.MainMenu.Content.Count > 0) { PrintMainMovement(); PrintPropertiesMovement(); } PrintAddMovement(); } PrintAttr(); mc.NoNeedScreenUpdate = false; }
public override void MoveDown() { CurPosition++; if (CurPosition == ConsoleHelpers.GetMaxStrings()) { Page++; Scrolled = true; CurPosition = 0; } if (CurPosition > Content.Count - 1 - ConsoleHelpers.GetMaxStrings() * Page) { CurPosition = 0; if (Page == Content.Count / ConsoleHelpers.GetMaxStrings() && Page != 0) { Page = 0; Scrolled = true; } } }
public override void MoveUp() { CurPosition--; if (Page > 0 && CurPosition < 0) { Page--; Scrolled = true; CurPosition = ConsoleHelpers.GetMaxStrings() - 1; } else if (CurPosition < 0) { if (Content.Count / ConsoleHelpers.GetMaxStrings() > 0 && !(Content.Count % ConsoleHelpers.GetMaxStrings() == 0 && Page == 0)) { Page = Content.Count / ConsoleHelpers.GetMaxStrings(); Scrolled = true; } CurPosition = Content.Count - 1 - ConsoleHelpers.GetMaxStrings() * Page; } }