Esempio n. 1
0
        public Node GetTreeNode(Node rootNode, Resource resource)
        {
            if ( !rootNode.IsFolder )
            {
                if (rootNode.ResourceId == resource.Id)
                {
                    return rootNode;
                }
            }

            foreach (Node childNode in rootNode.ChildNodes)
            {
                Node outNode = GetTreeNode(childNode, resource);
                if (outNode != null)
                {
                    return outNode;
                }
            }

            return null;
        }
Esempio n. 2
0
        public Node GetParentFolderTreeNode(Node rootNode, ref Node folderNode, Resource resource)
        {
            if (rootNode.IsFolder)
            {
                folderNode = rootNode;
            }
            else if (rootNode.ResourceId == resource.Id)
            {
                return rootNode;
            }

            foreach (Node childNode in rootNode.ChildNodes)
            {
                Node outNode = GetParentFolderTreeNode(childNode, ref folderNode, resource);
                if (outNode != null)
                {
                    return outNode;
                }
            }

            return null;
        }