示例#1
0
 public DirectOutputEntry(ColorTextBuilder textBuilder, int x, int y, DirectOutputMode directOutputMode)
 {
     TextBuilder      = textBuilder;
     X                = x;
     Y                = y;
     DirectOutputMode = directOutputMode;
 }
示例#2
0
 public DirectOutputEntry(string text, int x, int y, DirectOutputMode directOutputMode, Color?foregroundColor, Color?backgroundColor)
 {
     Text             = text;
     X                = x;
     Y                = y;
     DirectOutputMode = directOutputMode;
     ForegroundColor  = foregroundColor;
     BackgroundColor  = backgroundColor;
 }
        /// <summary>
        /// Write directly at a given position of the screen
        /// </summary>
        /// <param name="textBuilder"></param>
        /// <param name="xPos"></param>
        /// <param name="yPos"></param>
        /// <param name="directOutputMode">The mode which indicates when the text should be cleared</param>
        public void WriteAt(ColorTextBuilder textBuilder, int xPos, int yPos, DirectOutputMode directOutputMode)
        {
            var left = Console.CursorLeft;
            var top  = Console.CursorTop;

            Console.SetCursorPosition(xPos, yPos);
            _historyLock.Wait();
            try
            {
                _directOutputEntries.Add(new DirectOutputEntry(textBuilder, xPos, yPos, directOutputMode));
            }
            finally
            {
                _historyLock.Release();
            }
            Console.SetCursorPosition(left, top);
            _hasLogUpdates = true;
        }
        /// <summary>
        /// Write directly at a given position of the screen
        /// </summary>
        /// <param name="text"></param>
        /// <param name="xPos"></param>
        /// <param name="yPos"></param>
        /// <param name="directOutputMode">The mode which indicates when the text should be cleared</param>
        public void WriteAt(string text, int xPos, int yPos, DirectOutputMode directOutputMode, Color?foregroundColor = null, Color?backgroundColor = null)
        {
            var left = Console.CursorLeft;
            var top  = Console.CursorTop;

            Console.SetCursorPosition(xPos, yPos);
            _historyLock.Wait();
            try
            {
                _directOutputEntries.Add(new DirectOutputEntry(text, xPos, yPos, directOutputMode, foregroundColor, backgroundColor));
            }
            finally
            {
                _historyLock.Release();
            }
            Console.SetCursorPosition(left, top);
            _hasLogUpdates = true;
        }