Exemplo n.º 1
0
        /// <summary>
        /// Connects the parent node and child node based on the node relation. Iterates all the nodes present in the NodeRelation and connects it.
        /// </summary>
        internal void ResolveNodeRelations(string relationName)
        {
            NodeRelationDescriptor nodeRelation = this.nodeRelationCollection[relationName];

            if (nodeRelation != null)
            {
                //Ensure that the IList is present with the ChildSourceName
                if (this.SourceListSet[nodeRelation.ChildSourceName] != null)
                {
                    Diagram.BeginUpdate();

                    //Iterate thru the ChildSourceList and process the connections
                    foreach (object item in NodeReflectionStrategy.IterateListSource(this.SourceListSet[nodeRelation.ChildSourceName]))
                    {
                        AddConnection(nodeRelation, item);
                    }

                    Diagram.EndUpdate();
                }
                else
                {
                    throw new ArgumentException("object passed is not an instance of " + this.SourceListSet[nodeRelation.ChildSourceName].SourceName);
                }
            }
        }
Exemplo n.º 2
0
        private bool CheckItemInCollection(SourceListSetEntry source, object Obj)
        {
            bool result = false;

            foreach (object o in NodeReflectionStrategy.IterateListSource(source))
            {
                if (o.Equals(Obj))
                {
                    result = true;
                    break;
                }
            }
            return(result);
        }
        /// <summary>
        /// Resolves all the node present in the SourceListSet.
        /// </summary>
        /// <param name="item">The item.</param>
        internal void ResolveNodes(SourceListSetEntry item)
        {
            if (_sourceListSetColl.Contains(item))
            {
                this._diagramEngine.Diagram.BeginUpdate();

                //Loop thru each object that is present inside the IList of SourceListSet.
                foreach (object itemObj in NodeReflectionStrategy.IterateListSource(item))
                {
                    AddNode(item, itemObj);
                }
                //this._diagramEngine.RefreshLayoutManager( );
                this._diagramEngine.Diagram.EndUpdate();

                if (item.Source is System.ComponentModel.IBindingList)
                {
                    WireBindingList((IBindingList)item.Source);
                }
            }
            else
            {
                throw new ArgumentException("Unknown SourceListSet instance");
            }
        }