예제 #1
0
 private static void ShowEntryMenu()
 {
     for (int i = 10 - (cat[itemcat].entries.Count / 2); i < 11 + cat.Count; i++)
     {
         string buffer = "";
         AConsole.CursorTop = i;
         for (int j = 10; j <= 70; j++)
         {
             buffer += " ";
         }
         AConsole.CursorLeft = 10;
         AConsole.WriteEx(buffer, background, background);
     }
     AConsole.CursorTop = 11 - (cat[itemcat].entries.Count / 2);
     for (int i = 0; i < cat[itemcat].entries.Count; i++)
     {
         if (i == item)
         {
             WriteEx(cat[itemcat].entries[i].text, highlighted, background, true);
             CursorLeft = 69;
             WriteLineEx(">", arrow, background);
         }
         else
         {
             WriteLineEx(cat[itemcat].entries[i].text, normal, background, true);
         }
     }
     while (true)
     {
         ConsoleKey key = AConsole.ReadKey().Key;
         if (key == ConsoleKey.UpArrow)
         {
             if (item > 0)
             {
                 item--;
             }
             else
             {
                 item = cat[itemcat].entries.Count - 1;
             }
             break;
         }
         else if (key == ConsoleKey.DownArrow)
         {
             if (item < cat[itemcat].entries.Count - 1)
             {
                 item++;
             }
             else
             {
                 item = 0;
             }
             break;
         }
         else if (key == ConsoleKey.Enter || key == ConsoleKey.RightArrow)
         {
             cat[itemcat].entries[item].Execute();
             break;
         }
     }
 }