コード例 #1
0
        //argument passed from FindElement is a TreeNodeCollection
        public PPLElement FindCasePartDeux(string pName, TreeNodeCollection pNodes)
        {
            if (pNodes == null)
            {
                return((PPLElement)null);
            }
            foreach (TreeNode pNode in pNodes)
            {
                if (pNode.Tag is PPLElement)
                {
                    PPLElement tag      = (PPLElement)pNode.Tag;
                    string     elemName = tag.GetValueAndConvertToString("Name");
                    if (elemName.ToUpper() == pName.ToUpper())
                    {
                        PPLElement pplElement = tag.CopyElement();
                        pplElement.Parent = (PPLElement)null;
                        pplElement.Children.Clear();
                        return(pplElement);
                    }
                }

                if (pNode.Nodes != null && pNode.Nodes.Count > 0)
                {
                    PPLElement defaultElement = FindCasePartDeux(pName, pNode.Nodes);
                    if (defaultElement != null)
                    {
                        return(defaultElement);
                    }
                }
            }
            return((PPLElement)null);
        }
コード例 #2
0
        //argument passed from FindElement is a TreeNodeCollection
        public PPLElement FindElementPartDeux(string pGuid, TreeNodeCollection pNodes)
        {
            if (pNodes == null)
            {
                return((PPLElement)null);
            }
            foreach (TreeNode pNode in pNodes)
            {
                if (pNode.Tag is PPLElement)
                {
                    PPLElement tag      = (PPLElement)pNode.Tag;
                    string     elemGuid = tag.Guid.ToString();
                    if (elemGuid == pGuid)
                    {
                        PPLElement pplElement = tag.CopyElement();
                        pplElement.Parent = (PPLElement)null;
                        pplElement.Children.Clear();
                        return(pplElement);
                    }
                }

                if (pNode.Nodes != null && pNode.Nodes.Count > 0)
                {
                    PPLElement defaultElement = FindElementPartDeux(pGuid, pNode.Nodes);
                    if (defaultElement != null)
                    {
                        return(defaultElement);
                    }
                }
            }
            return((PPLElement)null);
        }