private void SetupScreen() { CLI.ForceClear(Color.Black); Shell.DrawTitleBar(); TextGraphics.FillRect(2, 2, CLI.Width - 4, CLI.Height - 3, ' ', Color.White, Color.Blue); CLI.SetCursorPos(2, 2); }
private void SetupScreen() { CLI.ForceClear(Color.Black); Shell.DrawTitleBar(); TextGraphics.FillRect(2, 2, CLI.Width - 4, CLI.Height - 3, ' ', Color.White, Color.Blue); TextGraphics.DrawLineH(2, 2, CLI.Width - 4, ' ', Color.White, Color.Cyan); TextGraphics.DrawString(2, 2, " CMD DESCRIPTION", Color.Black, Color.Cyan); TextGraphics.DrawLineH(0, 3, CLI.Width, ' ', Color.White, Color.Black); TextGraphics.DrawString(Shell.TitleBarTime.Length, 0, " | Run \"help [cmd]\" for usage", Shell.TitleColor, Shell.TitleBarColor); CLI.SetCursorPos(2, 2); }
private static void ReadInputMenu() { // draw document Draw(); // draw menu TextGraphics.FillRect(0, 1, 20, 5, ' ', Color.White, Shell.TitleBarColor); TextGraphics.DrawString(1, 1, "New", Color.White, Shell.TitleBarColor); TextGraphics.DrawString(1, 2, "Open...", Color.White, Shell.TitleBarColor); TextGraphics.DrawString(1, 3, "Save", Color.White, Shell.TitleBarColor); TextGraphics.DrawString(1, 4, "Save As...", Color.White, Shell.TitleBarColor); TextGraphics.DrawString(1, 5, "Exit", Color.White, Shell.TitleBarColor); TextGraphics.DrawChar(0, StartY + MenuIndex, '>', Color.Yellow, Shell.TitleBarColor); CLI.SetCursorPos(0, StartY + MenuIndex); try { ConsoleKeyInfo key = CLI.ReadKey(true); // return to document if (key.Key == ConsoleKey.Escape) { Draw(); ReadInput(); } // move up else if (key.Key == ConsoleKey.UpArrow) { if (MenuIndex > 0) { MenuIndex--; } } // move down else if (key.Key == ConsoleKey.DownArrow) { if (MenuIndex < 4) { MenuIndex++; } } // select option else if (key.Key == ConsoleKey.Enter) { // new document if (MenuIndex == 0) { Clear(true); } // load document if (MenuIndex == 1) { Load(); } // save document if (MenuIndex == 2) { if (PMFAT.FileExists(CurrentFile)) { Save(); } else { SaveAs(); } } // save document as if (MenuIndex == 3) { SaveAs(); } // exit if (MenuIndex == 4) { Exit(); } Draw(); ReadInput(); } ReadInputMenu(); } catch (Exception ex) { Clear(false); CLI.Write("[FATAL] ", Color.Red); CLI.WriteLine(ex.Message, Color.White); } }