コード例 #1
0
ファイル: TreeViewNode.cs プロジェクト: shangshen/cozy
        /// <summary>
        /// Flattens the tree recursively.
        /// </summary>
        /// <param name="flattendNodes">The flattened nodes.</param>
        /// <param name="depth">The depth.</param>
        private void FlattenTree(ref Collection <TreeViewNodeFlat> flattendNodes, int depth)
        {
            var flat = new TreeViewNodeFlat
            {
                Node  = this,
                Depth = depth
            };

            flattendNodes.Add(flat);

            depth = depth + 1;
            foreach (var child in this.Children)
            {
                var treeViewNode = child as TreeViewNode;
                if (treeViewNode == null)
                {
                    continue;
                }

                treeViewNode.FlattenTree(ref flattendNodes, depth);
            }
        }
コード例 #2
0
ファイル: TreeViewNode.cs プロジェクト: xxy1991/cozy
        /// <summary>
        /// Flattens the tree recursively.
        /// </summary>
        /// <param name="flattendNodes">The flattened nodes.</param>
        /// <param name="depth">The depth.</param>
        private void FlattenTree(ref Collection<TreeViewNodeFlat> flattendNodes, int depth)
        {
            var flat = new TreeViewNodeFlat
            {
                Node = this, 
                Depth = depth
            };
            flattendNodes.Add(flat);

            depth = depth + 1;
            foreach (var child in this.Children)
            {
                var treeViewNode = child as TreeViewNode;
                if (treeViewNode == null)
                {
                    continue;
                }

                treeViewNode.FlattenTree(ref flattendNodes, depth);
            }
        }