/// <summary> /// Loads a tree of remote sub folder with the depth of 2 /// </summary> /// <param name="credentials"></param> /// <param name="root"></param> /// <returns></returns> public static List <Node> LoadSubFolderDelegate(CmisRepoCredentials credentials, Node root) { CmisUtils.FolderTree tree = CmisUtils.GetSubfolderTree(credentials, root.Path, 2); List <Node> children = CreateSubTrees(tree.Children, null); foreach (Node child in children) { child.Parent = root; } return(children); }
private void Finished(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { Status = LoadingStatus.REQUEST_FAILURE; } else if (e.Cancelled) { Status = LoadingStatus.ABORTED; } else { if (e.Result is CmisSync.Lib.Cmis.CmisUtils.FolderTree) { CmisUtils.FolderTree repotree = e.Result as CmisUtils.FolderTree; foreach (CmisUtils.FolderTree repofolder in repotree.children) { Folder folder = new Folder(repofolder, this); this.Folder.Add(folder); } Status = LoadingStatus.DONE; } else { if (e.Result == null) { return; } string[] subfolder = (string[])e.Result; foreach (string f in subfolder) { Folder folder = new Folder() { Repo = this, Path = f, Name = f.Split('/')[f.Split('/').Length - 1], Parent = this, Type = CmisTree.Folder.FolderType.REMOTE, Enabled = this.selected }; this.Folder.Add(folder); this.queue.Enqueue(folder); } Status = LoadingStatus.DONE; if (this.queue.Count > 0 && !this.worker.CancellationPending) { this.folderworker.RunWorkerAsync(); } } } }
/// <summary> /// Constructor. /// </summary> public Folder(CmisUtils.FolderTree tree, CmisRepo repo) { this.Path = tree.path; this.Repo = repo; this.Name = tree.Name; this.Type = FolderType.REMOTE; this.Status = LoadingStatus.DONE; this.Enabled = repo.Selected; foreach (CmisUtils.FolderTree t in tree.children) { this.SubFolder.Add(new Folder(t, Repo) { Parent = this }); } }