Esempio n. 1
0
            public void Test_complex_display_dynamic_dimensions_with_lines()
            {
                ComplexDisplay display = new ComplexDisplay();

                DisplayLine line1 = new DisplayLine
                {
                    Canvas = new DisplayCanvas
                    {
                        Sizes = new List <int> {
                            0
                        },
                        DynamicIndex = 0
                    },
                    Texts = new List <DisplayText>
                    {
                        new DisplayText("test", 4)
                    }
                };//Total size = 4

                DisplayLine line2 = new DisplayLine
                {
                    Canvas = new DisplayCanvas
                    {
                        Sizes = new List <int> {
                            0
                        },
                        DynamicIndex = 0
                    },
                    Texts = new List <DisplayText>
                    {
                        new DisplayText("test", 5)
                    }
                };                  //Total size = 5

                display.Add(line1); //base size = 4
                display.Add(line2); //base size = 5
                //display.Add() modifies the size of each line so their size is equal to the longest line.
                //This is necessary so that lines with text after their name align.
                line1.TotalSize.Should().Be(5);
            }
Esempio n. 2
0
                public void Print(IEnumerable <UIItem> items)
                {
                    foreach (var item in items)
                    {
                        _display.Add(item.GetText());
                    }
                    _lines = items.Select(l => l.GetText().ToString()).ToArray();

                    foreach (var item in _display.Lines)
                    {
                        Console.WriteLine(item.ToString());
                    }
                }
Esempio n. 3
0
 public void Add(Component item)
 {
     item.Parent = this;
     Items.Add(item);
     MyComplexDisplay.Add(item.Display);
 }