/// <summary> /// Add or removes path from the folderList_. /// </summary> /// <param name="path"></param> /// <param name="add"></param> protected virtual void ExchangePath(string path, bool add) { if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException("path"); } // if (add) { if (!_folderList.Contains(path)) { _folderList.Add(path); // notfiy add OnSelectedDirectoriesChanged(new SelectedDirectoriesChangedEventArgs(path, System.Windows.Forms.CheckState.Checked)); } } else { if (_folderList.Contains(path)) { _folderList.Remove(path); // notfiy remove OnSelectedDirectoriesChanged(new SelectedDirectoriesChangedEventArgs(path, System.Windows.Forms.CheckState.Unchecked)); } } }
private void RemoveNodes(System.Collections.ObjectModel.Collection <Node> node, List <Node> NodesToDel) { for (int i = node.Count - 1; i >= 0; i--) { Node item = node[i]; NodesToDel.ForEach(n => { if (item == n) { node.Remove(item); } }); RemoveNodes(item.Nodes, NodesToDel); } }
public static System.Collections.ObjectModel.Collection <Node> RemoveNonExistantNode(System.Collections.ObjectModel.Collection <Node> NodeCollection) { OpfDocument opfDoc = new OpfDocument(); List <string> htmlFiles = opfDoc.GetFilesList("html"); for (int i = NodeCollection.Count - 1; i >= 0; i--) { Node item = NodeCollection[i]; NavDetails nav = item.Tag as NavDetails; if (nav.ContentSrc == null || !Utils.VerifyFileExists(nav.File) | !htmlFiles.Contains(nav.File)) { NodeCollection.Remove(item); } if (item.Nodes.Count > 0) { RemoveNonExistantNode(item.Nodes); } } return(NodeCollection); }