예제 #1
0
        private void node_ChildNodeLoading(object sender, TreeNodesLazyLoadingEventArgs e)
        {
            lock (sender)
            {
                var lst = _provider.GetChildCategory(((TreeNode)sender).Key);

                if (lst != null && lst.Count > 0)
                {
                    for (int i = 0; i < lst.Count; i++)
                    {
                        e.ChildList.Add((TreeNode)lst[i]);
                    }
                }
            }
        }
예제 #2
0
        private TreeNodeChildCollection buildCollection()
        {
            var collection = new TreeNodeChildCollection(this);

            collection.CollectionChanging += collection_CollectionChanging;
            collection.CollectionChanged  += collection_CollectionChanged;

            if (ChildNodeLoading != null)
            {
                var e = new TreeNodesLazyLoadingEventArgs();
                ChildNodeLoading(this, e);
                if (e.HasChildren)
                {
                    collection.AddRange(e.ChildList);
                }
            }

            return(collection);
        }