예제 #1
0
        public void StartReading()
        {
            int countKeyPressesed = 0;

            outputRenderer.SetWindow();
            outputRenderer.DrawFrame();
            outputRenderer.ShowInitialOptions(countKeyPressesed % elements);

            while (true)
            {
                ConsoleKey keyPressed = inpitProvider.Key();
                inpitProvider.ClearBuffer();

                if (keyPressed == ConsoleKey.UpArrow)
                {
                    countKeyPressesed = countKeyPressesed == 0 ? 4 : countKeyPressesed - 1;
                    outputRenderer.ShowInitialOptions(countKeyPressesed % elements);
                }
                else if (keyPressed == ConsoleKey.DownArrow)
                {
                    countKeyPressesed = countKeyPressesed == 4 ? 0 : countKeyPressesed + 1;
                    outputRenderer.ShowInitialOptions(countKeyPressesed % elements);
                }
                else if (keyPressed == ConsoleKey.Enter)
                {
                    Execute exe = new Execute();
                    outputRenderer.ShowWaiting(countKeyPressesed);
                    methods[countKeyPressesed].Invoke(exe, null);
                    if (countKeyPressesed != 2)
                    {
                        outputRenderer.ShowDone(countKeyPressesed);
                    }
                }
                Thread.Sleep(80);
            }
        }