Пример #1
0
        /// <summary>
        /// 递归遍历子目录
        /// </summary>
        /// <param name="nodeInfor"></param>
        /// <returns></returns>
        protected bool GetSubTreeNodeItemIsOn(BaseTreeNodeInfor nodeInfor)
        {
            if (nodeInfor.IsTreeNode)
            {
                return(nodeInfor.m_IsOn);
            }

            bool isHasItemOn = false;

            foreach (var item in nodeInfor.m_AllSubNodesInfor)
            {
                if (item.IsTreeNode)
                {
                    if (item.m_IsOn)
                    {
                        isHasItemOn = true;
                    }
                }
                else
                {
                    bool isSubINodeItemOn = false;
                    foreach (var subItem in item.m_AllSubNodesInfor)
                    {
                        isSubINodeItemOn = GetSubTreeNodeItemIsOn(subItem);
                        if (isSubINodeItemOn)
                        {
                            isHasItemOn = true;
                            return(isHasItemOn);
                        }
                    }//递归遍历子目录
                }
            }
            return(isHasItemOn);
        }
Пример #2
0
        protected void SetSubTreeNodeIsOnState(BaseTreeNodeInfor target, bool isOn)
        {
            if (target.IsTreeNode)
            {
                target.m_IsOn = isOn;
                return;
            }

            foreach (var item in target.m_AllSubNodesInfor)
            {
                if (item.IsTreeNode)
                {
                    item.m_IsOn = isOn;
                }
                else
                {
                    foreach (var subItem in item.m_AllSubNodesInfor)
                    {
                        SetSubTreeNodeIsOnState(subItem, isOn);
                    }
                }
            }
            target.m_IsOn = isOn;
        }