예제 #1
0
        public void LogText(string text)
        {
            if (ConsoleLogView.Text.Length != 0)
            {
                ConsoleLogView.AppendText("\n");
            }
            ConsoleLogView.AppendText(text);
            int newY = ConsoleLogView.TextLines.Length - 1;

            ConsoleLogView.SetCursorPos(0, newY);
        }
예제 #2
0
        private void keyPressedHandler(string keyPressed, Keys key)
        {
            if (Showing)
            {
                Console.Console console = Console.Console.Instance;
                if (console.History.Count > 0)
                {
                    bool doHistory = false;
                    if (key == Keys.Down)
                    {
                        doHistory = true;
                        if (this.historyIndex == -1)
                        {
                            this.historyIndex = 0;
                        }
                        else
                        {
                            this.historyIndex++;
                        }
                    }
                    else if (key == Keys.Up)
                    {
                        doHistory = true;
                        if (this.historyIndex == -1)
                        {
                            this.historyIndex = console.History.Count - 1;
                        }
                        else
                        {
                            this.historyIndex--;
                        }
                    }

                    if (doHistory)
                    {
                        if (this.historyIndex >= console.History.Count)
                        {
                            this.historyIndex = 0;
                        }
                        else if (this.historyIndex < 0)
                        {
                            this.historyIndex = console.History.Count - 1;
                        }

                        ConsoleInputView.Text = console.History[this.historyIndex];
                        ConsoleInputView.SetCursorPos(ConsoleInputView.Text.Length, 0);
                    }
                }
            }
        }