Beispiel #1
0
        void AddNode(RedBlackTree <LongDecimal, RowItem> .Node node)
        {
            var entityRow = EntityRow.FromBindingListViewNode(node);

            _entityRows.Add(node, entityRow);
            var rowItem = node.Value;

            while (rowItem != null)
            {
                var innerTreeNode = rowItem.Key as RedBlackTree <LongDecimal, object> .Node;
                if (innerTreeNode != null && ReferenceEquals(innerTreeNode, _innerTreeList.Tree))
                {
                    EntityRow innerListEntityRow;
                    if (!_entityRows.TryGetValue(innerTreeNode, out innerListEntityRow))
                    {
                        innerListEntityRow = EntityRow.FromInnerListNode(innerTreeNode);
                        _entityRows.Add(rowItem.Key, innerListEntityRow);
                    }
                    innerListEntityRow.AddChild(BindingListView.ViewInfo.ParentColumn, entityRow);
                }
                rowItem = rowItem.Parent;
            }
            foreach (var columnDescriptor in _entityIdColumns)
            {
                var value  = columnDescriptor.GetPropertyValue((RowItem)node.Value, null);
                var entity = value as IEntity;
                if (entity == null)
                {
                    continue;
                }
                EntityRow parentRow;
                if (!_entityRows.TryGetValue(entity, out parentRow))
                {
                    parentRow = EntityRow.FromEntity(entity);
                    _entityRows.Add(entity, parentRow);
                }
                parentRow.AddChild(columnDescriptor, entityRow);
            }
        }