예제 #1
0
        public void LoadTree(TreeNode <NodeData> node)
        {
            if (node.Data.State == NodeDataState.Unload)
            {
                List <TreeNode <NodeData> > loads = new List <TreeNode <NodeData> >();
                TraverseSelect(node, loads);
                GenericTree <NodeData> .Traverse(node, (nd) => nd.Data.State = NodeDataState.Loading);

                string[] urls = new string[loads.Count];
                for (int i = 0; i < loads.Count; i++)
                {
                    urls[i] = LoadUrlHelper.GetJsonUrl(GetPathWithoutRoot(loads[i]) + suffix);
                }
                ILoader loader = DownloadManager.Instance.GetDownloader(node.Data.Name, urls, ResType.Json, ParseLoadJson);
                loader.RegisterEvent(progressCtl.LoaderFinish);
                if (loads.Count > 0)
                {
                    progressCtl.AddLoader(loader);
                    Debug($"新增{loads.Count}个请求");
                }
            }
        }