Пример #1
0
        void dataEntry()
        {
            // take numbers from user
            listDataInput();

            Console.Clear();
            int currentButton = 1; // the default button which indicator starts from

            while (true)
            {
                Console.Clear();

                // making the Yes/No side menu
                InteractiveMenu.buttonDrawer(sideMenuButtonTexts, currentButton, ConsoleColor.Red, ConsoleColor.White);

                ConsoleKeyInfo userInput = Console.ReadKey();
                switch (userInput.Key)
                {
                case ConsoleKey.DownArrow:
                    currentButton = InteractiveMenu.buttonNavigator(1, sideMenuButtonTexts.Length - 1, currentButton, ConsoleKey.DownArrow);
                    break;

                case ConsoleKey.UpArrow:
                    currentButton = InteractiveMenu.buttonNavigator(1, sideMenuButtonTexts.Length - 1, currentButton, ConsoleKey.UpArrow);
                    break;

                case ConsoleKey.Enter:
                    switch (currentButton)
                    {
                    case 1:
                        listDataInput();
                        break;

                    case 2:
                        processClose();
                        return;

                    default:
                        break;
                    }
                    break;;

                default:
                    break;
                }
            }
        }
        public void LoseMenu()
        {
            bool exitLoseMenu  = false;
            int  currentButton = 1;

            while (!exitLoseMenu)
            {
                Console.Clear();

                InteractiveMenu.buttonDrawer(loseMenuTexts, currentButton, ConsoleColor.Red, ConsoleColor.White);

                ConsoleKeyInfo userInput = Console.ReadKey();
                switch (userInput.Key)
                {
                case ConsoleKey.DownArrow:
                    currentButton = InteractiveMenu.buttonNavigator(1, loseMenuTexts.Length - 1, currentButton, ConsoleKey.DownArrow);
                    break;

                case ConsoleKey.UpArrow:
                    currentButton = InteractiveMenu.buttonNavigator(1, loseMenuTexts.Length - 1, currentButton, ConsoleKey.UpArrow);
                    break;

                case ConsoleKey.Enter:
                    switch (currentButton)
                    {
                    case 1:
                        GameLaunch();
                        break;

                    case 2:
                        exitLoseMenu = true;
                        //MainMenu();
                        break;

                    default:
                        break;
                    }
                    break;

                default:
                    break;
                }
            }
        }
Пример #3
0
        // main process
        public void ElitePrimeChecker()
        {
            Console.Clear();
            int currentButton = 1;

            while (true)
            {
                Console.Clear();

                InteractiveMenu.buttonDrawer(menuButtonTexts, currentButton, ConsoleColor.Red, ConsoleColor.White);

                ConsoleKeyInfo userInput = Console.ReadKey();
                switch (userInput.Key)
                {
                case ConsoleKey.DownArrow:
                    currentButton = InteractiveMenu.buttonNavigator(1, menuButtonTexts.Length - 1, currentButton, ConsoleKey.DownArrow);
                    break;

                case ConsoleKey.UpArrow:
                    currentButton = InteractiveMenu.buttonNavigator(1, menuButtonTexts.Length - 1, currentButton, ConsoleKey.UpArrow);
                    break;

                case ConsoleKey.Enter:
                    switch (currentButton)
                    {
                    case 1:
                        primeCheckCalculation();
                        printPrimeNumbers();
                        break;

                    case 2:
                        return;

                    default:
                        break;
                    }
                    break;

                default:
                    break;
                }
            }
        }
Пример #4
0
        //main procces
        public void ScreenBuffer()
        {
            int currentButton = 1;

            while (true)
            {
                Console.Clear();

                InteractiveMenu.buttonDrawer(menuButtonTexts, currentButton, ConsoleColor.Red, ConsoleColor.White);


                ConsoleKeyInfo userInput = Console.ReadKey();
                switch (userInput.Key)
                {
                case ConsoleKey.DownArrow:
                    currentButton = InteractiveMenu.buttonNavigator(1, menuButtonTexts.Length - 1, currentButton, ConsoleKey.DownArrow);
                    break;

                case ConsoleKey.UpArrow:
                    currentButton = InteractiveMenu.buttonNavigator(1, menuButtonTexts.Length - 1, currentButton, ConsoleKey.UpArrow);
                    break;

                case ConsoleKey.Enter:
                    switch (currentButton)
                    {
                    case 1:
                        GridDrawer();
                        break;

                    case 2:
                        return;

                    default:
                        break;
                    }
                    break;

                default:
                    break;
                }
            }
        }
Пример #5
0
        // main process
        static void Main(string[] args)
        {
            if (defaultProgram != 0)
            {
                MainProgram mainProgram = new MainProgram();
                mainProgram.programLoader(defaultProgram);
                return;
            }
            int currentButton = 1;

            while (true)
            {
                Console.Clear();

                InteractiveMenu.buttonDrawer(mainMenuButtonTexts, currentButton, ConsoleColor.Red, ConsoleColor.White);

                ConsoleKeyInfo userInput = Console.ReadKey();
                switch (userInput.Key)
                {
                case ConsoleKey.UpArrow:
                    currentButton = InteractiveMenu.buttonNavigator(1, mainMenuButtonTexts.Length - 2, currentButton, ConsoleKey.UpArrow);
                    break;

                case ConsoleKey.DownArrow:
                    currentButton = InteractiveMenu.buttonNavigator(1, mainMenuButtonTexts.Length - 2, currentButton, ConsoleKey.DownArrow);
                    break;

                case ConsoleKey.Enter:
                    MainProgram mainProgram = new MainProgram();
                    mainProgram.programLoader(currentButton);
                    break;

                // quit console application
                case ConsoleKey.Escape:
                    return;

                default:
                    break;
                }
            }
        }
        public void ProgramStart()
        {
            while (true)
            {
                Console.Clear();

                // when there are still no posts
                while (posts.Count == 0)
                {
                    Console.WriteLine("There are no posts created yet, press Spacebar to create one!");

                    ConsoleKeyInfo userInput = Console.ReadKey();
                    switch (userInput.Key)
                    {
                    case ConsoleKey.Spacebar:
                        CreatePost();
                        break;

                    default:
                        break;
                    }
                }
                //if there is atleast one post created
                int currentButton = 1;
                while (posts.Count > 0)
                {
                    Console.ResetColor();
                    Console.Clear();

                    string[] buttonTexts = new string[posts.Count + 1];
                    for (int i = 0; i < buttonTexts.Length; i++)
                    {
                        if (i > 0)
                        {
                            buttonTexts[i] = posts[i - 1].PostName;
                        }
                        else
                        {
                            buttonTexts[i] = "Select a post and press enter to see details. Press Spacebar to create a new post!\n";
                        }
                    }

                    InteractiveMenu.buttonDrawer(buttonTexts, currentButton, ConsoleColor.Red, ConsoleColor.White);

                    ConsoleKeyInfo userInput = Console.ReadKey();
                    switch (userInput.Key)
                    {
                    case ConsoleKey.UpArrow:
                        currentButton = InteractiveMenu.buttonNavigator(1, buttonTexts.Length - 1, currentButton, ConsoleKey.UpArrow);
                        break;

                    case ConsoleKey.DownArrow:
                        currentButton = InteractiveMenu.buttonNavigator(1, buttonTexts.Length - 1, currentButton, ConsoleKey.DownArrow);
                        break;

                    case ConsoleKey.Enter:
                        PostDetail(currentButton - 1);
                        break;

                    case ConsoleKey.Spacebar:
                        CreatePost();
                        break;

                    default:
                        break;
                    }
                }
            }
        }