Пример #1
0
        public void OnKeyPress(ConsoleKeyInfo info)
        {
            ConsoleKey key = info.Key;


            switch (key)
            {
            case ConsoleKey.UpArrow:
                index--;
                if (index < 0)
                {
                    index = repo.TotalOutings - 1;
                }
                break;

            case ConsoleKey.DownArrow:
                index++;
                if (index >= repo.TotalOutings)
                {
                    index = 0;
                }
                break;

            case ConsoleKey.Delete:
                repo.RemoveOuting(index);
                while (index >= repo.TotalOutings && repo.TotalOutings > 0)
                {
                    index--;
                }
                break;

            case ConsoleKey.C:
                repo.ShowOutingCostsByType();
                break;

            case ConsoleKey.N:
                CreateOuting();
                break;

            case ConsoleKey.Escape:
                isRunning = false;
                break;

            default:
                Console.WriteLine((int)key);
                Console.ReadKey();
                break;
            }
        }