Esempio n. 1
0
        private void EchoImpl(string str)
        {
            ConsoleColor fg = Console2.ForegroundColor;

            Console2.ForegroundColor = ConsoleColor.White;
            Console2.WriteLine("Echo: " + str);
            Console2.ForegroundColor = fg;
        }
Esempio n. 2
0
        public bool WritePublicText(string value, bool append = false)
        {
            float fontSize     = (this.GetProperty("FontSize") as ITerminalProperty <float>).GetValue(this);
            int   visibleCount = (int)((33 * 0.8 / fontSize) + 0.0001); // rounding magic

            ConsoleColor fg = Console2.ForegroundColor;
            ConsoleColor bg = Console2.BackgroundColor;

            Console2.ForegroundColor = ConsoleColor.Gray;
            Console2.WriteLine("LCD:");


            string[] lines = value.Split('\n').Select(x => x.Trim('\r')).ToArray();
            foreach (string line in lines)
            {
                string visiblePart = line.Substring(0, Math.Min(line.Length, visibleCount));
                string hiddenPart  = line.Substring(Math.Min(line.Length, visibleCount));

                Console2.ForegroundColor = ConsoleColor.Cyan;
                Console2.BackgroundColor = ConsoleColor.Black;
                Console2.Write(visiblePart);

                //Console2.ForegroundColor = ConsoleColor.DarkBlue;
                //Console2.BackgroundColor = ConsoleColor.DarkGray;

                if (hiddenPart.Length > 0)
                {
                    Console2.Write(hiddenPart);
                }
                else
                {
                    Console2.CursorLeft = Console2.CursorLeft + visibleCount - visiblePart.Length;
                    Console2.Write(" ");
                }
                Console2.BackgroundColor = ConsoleColor.Black;
                Console2.WriteLine();
            }

            Console2.ForegroundColor = fg;
            Console2.BackgroundColor = bg;

            return(true);
            //throw new NotImplementedException();
        }