Beispiel #1
0
        public void ChangeState(object sender, KeyEventArgs e)
        {
            switch (e.Cki.Key)
            {
            case ConsoleKey.I:
            case ConsoleKey.U:
            case ConsoleKey.P:
                if (ipBox.Active)
                {
                    int startPosX = ipBox.TopLeft.PosX + 1;
                    int startPosY = ipBox.TopLeft.PosY + 1;
                    Console.SetCursorPosition(startPosX, startPosY);
                    Console.Write(">");
                    input = Console.ReadLine();
                    inputFilter.SetInput(input);
                }
                else
                {
                    ipBox.Active = true;
                }
                break;

            case ConsoleKey.Enter:
                if (ipBox.Active)
                {
                    int startPosX = ipBox.TopLeft.PosX + 1;
                    int startPosY = ipBox.TopLeft.PosY + 1;
                    Console.SetCursorPosition(startPosX, startPosY);
                    string text = "";
                    for (int i = 0; i <= input.Length; i++)
                    {
                        text += " ";
                    }
                    Console.WriteLine(text);
                    Console.SetCursorPosition(0, 0);
                    ipBox.Active = false;
                }
                break;
            }
        }