private void AddFolder() { var newFolderNode = new FolderConfigurationNodeBase.ContainerNode("New Folder"); _selectedFolderNode.AddChildNode(newFolderNode); this.SelectedFolderNode = new Selection(newFolderNode); EventsHelper.Fire(_onEditFolder, this, EventArgs.Empty); }
/// <summary> /// Replace a child node with a new node. /// </summary> public void ReplaceChildNode(FolderConfigurationNodeBase oldChildNode, FolderConfigurationNodeBase newChildNode) { // Move the subtree of the old node to the new node. foreach (var node in oldChildNode.SubTree.Items) { newChildNode.AddChildNode(node); } oldChildNode.ClearSubTree(); newChildNode.Parent = oldChildNode.Parent; // replace the nodes var index = this.SubTree.Items.IndexOf(oldChildNode); this.SubTree.Items.Insert(index, newChildNode); this.SubTree.Items.Remove(oldChildNode); this.Modified = true; }