/// <summary> /// </summary> /// <param name="folderText"></param> public void AddFolder(string folderText) { NuGenFolderTreeNode folderNode = new NuGenFolderTreeNode(this.ServiceProvider, folderText); this.InitializeFolder(folderNode); this.AddFolder(folderNode); }
/* * AddFolder */ /// <summary> /// </summary> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="folderNodeToAdd"/> is <see langword="null"/>. /// </exception> public void AddFolder(NuGenFolderTreeNode folderNodeToAdd) { if (folderNodeToAdd == null) { throw new ArgumentNullException("folderNodeToAdd"); } NuGenTreeNode selectedNode = (NuGenTreeNode)this.SelectedNode; if (selectedNode != null && selectedNode.Parent != null) { if ( selectedNode.Parent is NuGenTaskTreeNodeBase && ((NuGenTaskTreeNodeBase)selectedNode.Parent).IsRemovable ) { selectedNode.Parent.Nodes.AddNode(folderNodeToAdd); } else { this.Nodes.AddNode(folderNodeToAdd); } } else { this.Nodes.AddNode(folderNodeToAdd); } this.SelectedNode = folderNodeToAdd; this.OnFolderAdded(EventArgs.Empty); this.OnEventToBeDelayed(new NuGenTaskAddedEventArgs(folderNodeToAdd.Text)); }
/// <summary> /// </summary> /// <exception cref="ArgumentNullException"> /// <paramref name="folderNodeToInitialize"/> is <see langword="null"/>. /// </exception> protected virtual void InitializeFolder(NuGenFolderTreeNode folderNodeToInitialize) { if (folderNodeToInitialize == null) { throw new ArgumentNullException("folderNodeToInitialize"); } Debug.Assert(this.ImageListService != null, "this.ImageListService != null"); Debug.Assert(this.ImageList != null, "this.ImageList != null"); folderNodeToInitialize.ImageIndex = this.ImageListService.GetImageIndex(this.ImageList, FOLDER); folderNodeToInitialize.ExpandedImageIndex = this.ImageListService.GetImageIndex(this.ImageList, FOLDER_OPEN); }
/// <summary> /// </summary> /// <param name="xmlNodeToLoadFrom"></param> /// <param name="parentNodeCollection"></param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="xmlNodeToLoadFrom"/> is <see langword="null"/>. /// -or- /// <paramref name="parentNodeCollection"/> is <see langword="null"/>. /// </exception> protected void LoadNode(XmlNode xmlNodeToLoadFrom, NuGenTreeNodeCollection parentNodeCollection) { if (xmlNodeToLoadFrom == null) { throw new ArgumentNullException("xmlNodeToLoadFrom"); } if (parentNodeCollection == null) { throw new ArgumentNullException("parentNodeCollection"); } NuGenTaskTreeNodeBase treeNodeToAdd = null; if (xmlNodeToLoadFrom.Name == Resources.XmlTag_Folder) { treeNodeToAdd = new NuGenFolderTreeNode(this.ServiceProvider); this.InitializeFolder((NuGenFolderTreeNode)treeNodeToAdd); } else if (xmlNodeToLoadFrom.Name == Resources.XmlTag_Task) { treeNodeToAdd = new NuGenTaskTreeNode(this.ServiceProvider); this.InitializeTask((NuGenTaskTreeNode)treeNodeToAdd); } else { return; } parentNodeCollection.AddNode(treeNodeToAdd); treeNodeToAdd.Load(xmlNodeToLoadFrom); foreach (XmlNode childNode in xmlNodeToLoadFrom.ChildNodes) { this.LoadNode(childNode, treeNodeToAdd.Nodes); } }
/// <summary> /// </summary> /// <exception cref="ArgumentNullException"> /// <paramref name="folderNodeToInitialize"/> is <see langword="null"/>. /// </exception> protected virtual void InitializeFolder(NuGenFolderTreeNode folderNodeToInitialize) { if (folderNodeToInitialize == null) { throw new ArgumentNullException("folderNodeToInitialize"); } Debug.Assert(this.ImageListService != null, "this.ImageListService != null"); Debug.Assert(this.ImageList != null, "this.ImageList != null"); folderNodeToInitialize.ImageIndex = this.ImageListService.GetImageIndex(this.ImageList, FOLDER); folderNodeToInitialize.ExpandedImageIndex = this.ImageListService.GetImageIndex(this.ImageList, FOLDER_OPEN); }
/// <summary> /// </summary> /// <param name="xmlNodeToLoadFrom"></param> /// <param name="parentNodeCollection"></param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="xmlNodeToLoadFrom"/> is <see langword="null"/>. /// -or- /// <paramref name="parentNodeCollection"/> is <see langword="null"/>. /// </exception> protected void LoadNode(XmlNode xmlNodeToLoadFrom, NuGenTreeNodeCollection parentNodeCollection) { if (xmlNodeToLoadFrom == null) { throw new ArgumentNullException("xmlNodeToLoadFrom"); } if (parentNodeCollection == null) { throw new ArgumentNullException("parentNodeCollection"); } NuGenTaskTreeNodeBase treeNodeToAdd = null; if (xmlNodeToLoadFrom.Name == Resources.XmlTag_Folder) { treeNodeToAdd = new NuGenFolderTreeNode(this.ServiceProvider); this.InitializeFolder((NuGenFolderTreeNode)treeNodeToAdd); } else if (xmlNodeToLoadFrom.Name == Resources.XmlTag_Task) { treeNodeToAdd = new NuGenTaskTreeNode(this.ServiceProvider); this.InitializeTask((NuGenTaskTreeNode)treeNodeToAdd); } else { return; } parentNodeCollection.AddNode(treeNodeToAdd); treeNodeToAdd.Load(xmlNodeToLoadFrom); foreach (XmlNode childNode in xmlNodeToLoadFrom.ChildNodes) { this.LoadNode(childNode, treeNodeToAdd.Nodes); } }
/// <summary> /// </summary> /// <param name="folderText"></param> public void AddFolder(string folderText) { NuGenFolderTreeNode folderNode = new NuGenFolderTreeNode(this.ServiceProvider, folderText); this.InitializeFolder(folderNode); this.AddFolder(folderNode); }
/* * AddFolder */ /// <summary> /// </summary> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="folderNodeToAdd"/> is <see langword="null"/>. /// </exception> public void AddFolder(NuGenFolderTreeNode folderNodeToAdd) { if (folderNodeToAdd == null) { throw new ArgumentNullException("folderNodeToAdd"); } NuGenTreeNode selectedNode = (NuGenTreeNode)this.SelectedNode; if (selectedNode != null && selectedNode.Parent != null) { if ( selectedNode.Parent is NuGenTaskTreeNodeBase && ((NuGenTaskTreeNodeBase)selectedNode.Parent).IsRemovable ) { selectedNode.Parent.Nodes.AddNode(folderNodeToAdd); } else { this.Nodes.AddNode(folderNodeToAdd); } } else { this.Nodes.AddNode(folderNodeToAdd); } this.SelectedNode = folderNodeToAdd; this.OnFolderAdded(EventArgs.Empty); this.OnEventToBeDelayed(new NuGenTaskAddedEventArgs(folderNodeToAdd.Text)); }
private void PopulateTaskTreeView() { NuGenTaskTreeNode task = new NuGenTaskTreeNode( this._ServiceProvider, this._TaskText, this._TaskPriority ); task.Text = this._TaskText; task.Checked = true; NuGenTaskTreeNode task2 = new NuGenTaskTreeNode( this._ServiceProvider, this._Task2Text, this._Task2Priority ); task2.Text = this._Task2Text; NuGenFolderTreeNode folder = new NuGenFolderTreeNode( this._ServiceProvider, this._FolderText ); folder.Text = this._FolderText; NuGenTaskTreeNode folderChild = new NuGenTaskTreeNode( this._ServiceProvider, this._FolderChildText, this._FolderChildPriority ); folderChild.Checked = true; folderChild.Text = this._FolderChildText; folder.Nodes.AddNode(folderChild); this._TaskTreeView.Nodes.AddNodeRange(new NuGenTreeNode[] { task, task2, folder }); }