private void RemoveBusinessObjectNode(IBusinessObject businessObject)
        {
            if (businessObject != null && ObjectNodes.ContainsKey(businessObject))
            {
                NodeState nodeState  = ObjectNodes[businessObject];
                ITreeNode node       = nodeState.Node;
                ITreeNode parentNode = node.Parent;
                RemoveNode(businessObject, node);

                IDictionary <string, IRelationship> relationships = GetVisibleRelationships(businessObject);
                foreach (KeyValuePair <string, IRelationship> relationshipPair in relationships)
                {
                    IRelationship relationship = relationshipPair.Value;
                    RemoveRelationshipNode(relationship);
                }
                if (parentNode != null)
                {
                    IBusinessObjectCollection businessObjectCollection = parentNode.Tag as IBusinessObjectCollection;
                    if (businessObjectCollection != null)
                    {
                        UpdateNodeDummy(nodeState, businessObjectCollection.Count);
                    }
                }
            }
        }
        private ITreeNode SetupBusinessObjectNode(IBusinessObject businessObject, ITreeNodeCollection nodes)
        {
            ITreeNode node;
            NodeState nodeState;

            if (!ObjectNodes.ContainsKey(businessObject))
            {
                node = nodes.Add("");
                node.Collapse(false);
                if (_levelsToDisplay > -1 && node.Level > _levelsToDisplay)
                {
                    nodes.Remove(node);
                    return(null);
                }
                nodeState          = new NodeState(node);
                nodeState.IsLoaded = false;
                UpdateNodeDummy(nodeState, GetVisibleRelationships(businessObject).Count);

                //LoadChildrenNodes(nodeState.Node.Nodes, businessObject);
                ObjectNodes.Add(businessObject, nodeState);
                //                LoadObjectNode(businessObject);
                RegisterForBusinessObjectEvents(businessObject);
            }
            else
            {
                nodeState = ObjectNodes[businessObject];
                node      = nodeState.Node;
            }
            DoSetupNodeWithBusinessObject(node, businessObject);
            node.Tag = businessObject;
            return(node);
        }
 private NodeState GetBusinessObjectNodeState(IBusinessObject businessObject)
 {
     if (ObjectNodes.ContainsKey(businessObject))
     {
         return(ObjectNodes[businessObject]);
     }
     return(null);
 }
 private void RefreshBusinessObjectNode(IBusinessObject businessObject)
 {
     if (businessObject != null && ObjectNodes.ContainsKey(businessObject))
     {
         NodeState nodeState = ObjectNodes[businessObject];
         ITreeNode node      = nodeState.Node;
         DoSetupNodeWithBusinessObject(node, businessObject);
         //node.Text = GetClassDescription(businessObject);
     }
 }
 ///<summary>
 /// Sets the business object's node as the selected node.
 ///</summary>
 ///<param name="businessObject"></param>
 public void SelectObject(IBusinessObject businessObject)
 {
     if (ObjectNodes.ContainsKey(businessObject))
     {
         NodeState nodeState = ObjectNodes[businessObject];
         ITreeNode node      = nodeState.Node;
         if (TreeView.SelectedNode != node)
         {
             _preventSelectionChanged = true;
             TreeView.SelectedNode    = node;
             _preventSelectionChanged = false;
         }
     }
 }