コード例 #1
0
        public static void StartScreenMethod()
        {
            WriteToScreen(0, 1);
            while (true)
            {
                ConsoleKeyInfo key = Console.ReadKey(true);
                if (key.Key == ConsoleKey.DownArrow || key.Key == ConsoleKey.UpArrow)
                {
                    WriteToScreen(2, 3);
                    ConsoleKeyInfo key1 = Console.ReadKey(true);
                    switch (key1.Key)
                    {
                    case ConsoleKey.Enter:
                        Environment.Exit(0);
                        break;

                    case ConsoleKey.DownArrow:
                        WriteToScreen(0, 1);
                        break;

                    case ConsoleKey.UpArrow:
                        WriteToScreen(0, 1);
                        break;
                    }
                }
                else if (key.Key == ConsoleKey.Enter)
                {
                    OrderTicketScreen.SelectTicketScreen();
                    break;
                }
            }
        }
コード例 #2
0
        public static void DetermineKeyInput(ConsoleKeyInfo k, int w1n1, int w1n2, int w1n3, int w2n1, int w2n2,
                                             int w2n3)
        {
            switch (k.Key)
            {
            case ConsoleKey.UpArrow:
                WriteToScreen(w1n1, w1n2, w1n3);
                if (count > 0)
                {
                    count -= 1;
                }
                else
                {
                    count = 2;
                }
                break;

            case ConsoleKey.DownArrow:
                WriteToScreen(w2n1, w2n2, w2n3);
                if (count < 2)
                {
                    count += 1;
                }
                else
                {
                    count = 0;
                }
                break;

            case ConsoleKey.Enter:
                switch (count)
                {
                case 0:
                    EnterInformationScreen.SelectedVehicleType = Constants.VehicleType.CAR;
                    EnterInformationScreen.EnterInfoScreen();
                    break;

                case 1:
                    EnterInformationScreen.SelectedVehicleType = Constants.VehicleType.MOTORCYCLE;
                    EnterInformationScreen.EnterInfoScreen();
                    break;

                case 2:
                    EnterInformationScreen.SelectedVehicleType = Constants.VehicleType.NONE;
                    OrderTicketScreen.SelectTicketScreen();
                    break;
                }
                break;
            }
        }