Exemplo n.º 1
0
        public void InitMultiple()
        {
            Init();

            for (int i = 1; i < locators.Length; i++)
            {
                var right = new TableScope <T>(scope, isHeader, locators[i]);
                right.Init();
                Merge(right);
            }
        }
Exemplo n.º 2
0
        public void Merge(TableScope <T> right)
        {
            if (this.RowsOfElements.Count != right.RowsOfElements.Count)
            {
                throw new Exception("Row count is different in the tables being merged.");
            }

            var result = new TableScope <T>
            {
                RowsOfElements = new List <List <ElementScope> >(),
                Header         = new List <ElementScope>(),
                HeaderCaptions = new List <string>()
            };

            for (int r = 0; r < this.RowsOfElements.Count; r++)
            {
                result.RowsOfElements.Add(new List <ElementScope>());
                foreach (var c in this.RowsOfElements[r])
                {
                    result.RowsOfElements[r].Add(c);
                }
                foreach (var c in right.RowsOfElements[r])
                {
                    result.RowsOfElements[r].Add(c);
                }
            }

            foreach (var c in this.Header)
            {
                result.Header.Add(c);
                result.HeaderCaptions.Add(c.Text);
            }
            foreach (var c in right.Header)
            {
                result.Header.Add(c);
                result.HeaderCaptions.Add(c.Text);
            }

            this.RowsOfElements = result.RowsOfElements;
            this.Header         = result.Header;
            this.HeaderCaptions = result.HeaderCaptions;
        }