Пример #1
0
            /// <summary>
            /// Starts the menu system
            /// the function returns an integer when the user clicks on the (Enter key)
            /// the integer value is 0 for the first item, 1 for the second item, n for the nth item
            /// </summary>
            public static int StartTheMenuSystem()
            {
                ClearFunctions.ClearAll();
                while (isChoosing)
                {
                    for (int i = 0; i < items.Count; i++)
                    {
                        if (i == CurrentHoverItemIndex)
                        {
                            //Choose Hover Item Color
                            Console.ForegroundColor = ConsoleColor.Red;
                            Write.Middle(items[i], 0, i);
                            //Normal Item Color
                            Console.ForegroundColor = ConsoleColor.White;
                            continue;
                        }
                        Write.Middle(items[i], i * HorizontalSpace, i * VerticalSpace);
                    }

                    CheckForMenuInput();
                    ClearFunctions.ClearAll();
                }

                return(CurrentHoverItemIndex);
            }
Пример #2
0
 public static void MiddleC(string s, int x = 0, int y = 0)
 {
     ClearFunctions.ClearAll();
     Console.SetCursorPosition(Math.Abs((Console.WindowWidth - s.Length) / 2 + x), Math.Abs((Console.WindowHeight / 2) + y));
     Console.Write(s);
 }