private void AddFolderNode(KTreeNode node, KTreeNodes children, AvailableFolder folder) { StoreTreeNode rootNode = (StoreTreeNode)this.Children.Parent; // Create the tree node SharedFolder share = rootNode.GetInitialShareState(folder); FolderTreeNode child = new FolderTreeNode(rootNode, folder, share); ApplyReadOnly(child, child.IsReadOnly); // Add children.Add(child); // Add the children foreach (AvailableFolder childFolder in folder.Children.OrderBy(f => f, new FolderComparer(false))) { AddFolderNode(child, child.Children, childFolder); } // Set the initial share state if (share != null) { child.IsChecked = true; } // Add the share; it might have become checked by any of the child nodes if (child.IsShared) { rootNode.AddShare(folder, share); } }
protected override void DoRenderChildren(KTreeNode node, object loaded, KTreeNodes children) { List <AvailableFolder> folders = (List <AvailableFolder>)loaded; foreach (AvailableFolder folder in folders.OrderBy(f => f, new FolderComparer(true))) { AddFolderNode(node, children, folder); } }
protected override string GetPlaceholderText(LoadingState state, KTreeNodes children) { switch (state) { case KTreeNodeLoader.LoadingState.Error: return(Properties.Resources.SharedFolders_Loading_Error); case KTreeNodeLoader.LoadingState.Loading: return(Properties.Resources.SharedFolders_Loading); case KTreeNodeLoader.LoadingState.Loaded: if (children.Count == 0) { return(Properties.Resources.SharedFolders_None); } return(null); } return(null); }