Example #1
0
        public override List <string> Render()
        {
            var builder = new List <string>();

            // Header
            //              ┌   ─   ┤   _   $NAME           _   ├   ─   ┐
            int minLength = 1 + 1 + 1 + 1 + Name.Length + 1 + 1 + 1 + 1;

            var targetWidth = Math.Max(minLength, ActualWidth);

            int    headerSpaces = Math.Max(0, ActualWidth - minLength);
            string header       = UpperLeftBorder + HorizontalLine + RightIntersection + " " + Name + " " + LeftIntersection + (new String(HorizontalLine.First(), headerSpaces)) + HorizontalLine + UpperRightBorder;

            builder.Add(header);

            // Content
            //
            var content = Content.Render();

            while (content.Count() < ActualHeight - 2)
            {
                content.Add("");
            }
            foreach (var line in content)
            {
                string l = VerticalLine + " " + line.PadRight(targetWidth - 4) + " " + VerticalLine;
                builder.Add(l);
            }

            // Footer
            //
            string footer = LowerLeftBorder + (new String(HorizontalLine.First(), targetWidth - 2)) + LowerRightBorder;

            builder.Add(footer);

            return(builder);
        }