Пример #1
0
        /// <summary>
        /// Resizes the screen of the terminal to the specified screen size.
        /// </summary>
        /// <param name="rows">The amount of rows on the screen.</param>
        /// <param name="columns">The amount of columns on the screen.</param>
        public void ResizeScreen(int rows, int columns)
        {
            if (this.screen == null)
            {
                this.screen = new Screen(rows, columns);
                this.screenInitWaiter.Set();
            }
            else
            {
                using (var modifier = this.screen.GetModifier())
                {
                    if (this.localReadSync != null)
                    {
                        modifier.Erase(this.localReadStartRow, this.localReadStartColumn, modifier.CursorRow, modifier.CursorColumn, null);
                        modifier.CursorRow    = this.localReadStartRow;
                        modifier.CursorColumn = this.localReadStartColumn;
                    }

                    modifier.Resize(rows, columns);

                    if (this.localReadSync != null)
                    {
                        foreach (var localReadPromptChar in this.localReadPrompt)
                        {
                            this.DrawLocalModeChar(localReadPromptChar, modifier, echo: true);
                        }

                        foreach (var localReadInputChar in this.localReadLine)
                        {
                            this.DrawLocalModeChar(localReadInputChar, modifier, echo: this.localReadEcho);
                        }
                    }
                }

                IConnection connection = this.connection;
                if (connection != null && connection.IsConnected)
                {
                    connection.ResizeTerminal(rows, columns);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Resizes the screen of the terminal to the specified screen size.
        /// </summary>
        /// <param name="rows">The amount of rows on the screen.</param>
        /// <param name="columns">The amount of columns on the screen.</param>
        public void ResizeScreen(int rows, int columns)
        {
            if (this.screen == null)
            {
                this.screen = new Screen(rows, columns);
                this.screenInitWaiter.Set();
            }
            else
            {
                using (var modifier = this.screen.GetModifier())
                {
                    if (this.localReadSync != null)
                    {
                        modifier.Erase(this.localReadStartRow, this.localReadStartColumn, modifier.CursorRow, modifier.CursorColumn, null);
                        modifier.CursorRow = this.localReadStartRow;
                        modifier.CursorColumn = this.localReadStartColumn;
                    }

                    modifier.Resize(rows, columns);

                    if (this.localReadSync != null)
                    {
                        foreach (var localReadPromptChar in this.localReadPrompt)
                        {
                            this.DrawLocalModeChar(localReadPromptChar, modifier, echo: true);
                        }

                        foreach (var localReadInputChar in this.localReadLine)
                        {
                            this.DrawLocalModeChar(localReadInputChar, modifier, echo: this.localReadEcho);
                        }
                    }
                }

                if (this.connection.IsConnected)
                {
                    this.connection.ResizeTerminal(rows, columns);
                }
            }
        }