Exemple #1
0
        public static void SetChecked(this FTreeNode node, bool isChecked)
        {
            node.IsChecked = isChecked;

            if (node.Children != null && node.Children.Any())
            {
                foreach (var childNode in node.Children)
                {
                    SetChecked(childNode, isChecked);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 获取当前节点下所有文件,包括子目录下的文件
        /// </summary>
        /// <param name="node">节点信息</param>
        /// <returns></returns>
        public static IEnumerable <FTreeNode> GetFTreeNodes(this FTreeNode node)
        {
            var nodes = new List <FTreeNode>();

            nodes.Add(node);

            if (node.Children.Count == 0)
            {
                return(nodes);
            }

            foreach (var fTreeNode in node.Children)
            {
                nodes.AddRange(fTreeNode.GetFTreeNodes());
            }
            return(nodes);
        }
Exemple #3
0
        /// <summary>
        /// 获取当前节点下所有文件,包括子目录下的文件
        /// </summary>
        /// <param name="node">节点信息</param>
        /// <param name="suffixs">后缀信息</param>
        /// <returns></returns>
        public static IEnumerable <FTreeNode> GetFTreeNodes(this FTreeNode node, List <string> suffixs)
        {
            var nodes = new List <FTreeNode>();

            if (node.Name != null)
            {
                var result = suffixs.Find(o => node.Name.EndsWith(o));
                if (result != null)
                {
                    nodes.Add(node);
                }
            }

            if (node.Children.Count == 0)
            {
                return(nodes);
            }

            foreach (var child in node.Children)
            {
                nodes.AddRange(child.GetFTreeNodes(suffixs));
            }
            return(nodes);
        }