Пример #1
0
    /// <summary>
    /// Create new method for expand current node
    /// </summary>
    /// <param name="SelectedNode"></param>
    public NodeCollection ExpandSubNodes(bool clickednode)
    {
        NodeCollection expandCollection = new NodeCollection();

        ExpandedCollection = new NodeCollection();
        IGraphNode thisNode = this as IGraphNode;

        if (thisNode != null)
        {
            ICollection edgesLeaving = thisNode.EdgesLeaving;
            if (edgesLeaving != null)
            {
                foreach (IGraphEdge curEdge in edgesLeaving)
                {
                    // Get from IGraphEdge link.
                    ConnectorBase outlink = curEdge as ConnectorBase;

                    if (outlink != null)
                    {
                        // Get from link children of current symbol.
                        EmpSymbol cursymbol = outlink.ToNode as EmpSymbol;
                        if (cursymbol != null)
                        {
                            // Check for explanded and explande nodes in child symbol.
                            if (cursymbol.IsExpanded)
                            {
                                cursymbol.ExpandSubNodes(false);
                            }

                            // Set current symbol as visible.
                            cursymbol.Visible = true;
                            expandCollection.Add(cursymbol);
                        }

                        // Set connected link as visible too.
                        outlink.Visible = true;
                        expandCollection.Add(outlink);
                    }
                }
            }
        }
        ExpandedCollection = expandCollection;
        // If this symbol is node under mouse click set node state as
        // expaned by make plus vertical line visibly.
        if (clickednode && HasChild())
        {
            // Set symbol shapes to indicate an expanded state.
            m_bExpanded = true;
        }
        return(expandCollection);
    }