public void MoveTo(XmlTreeNodeImpl newParent) { if (Parent == newParent || this == newParent) { return; } MoveTo(newParent, newParent.Nodes.Count); }
public void CreateChildNodes() { foreach (XmlClass child in XmlInstance.Children) { XmlTreeNodeImpl childnode = CreateNode(child); Nodes.Add(childnode); childnode.CreateChildNodes(); } }
public void MoveTo(XmlTreeNodeImpl newParent, int index) { if (Parent != null && newParent.Tag is XmlClass && Tag is XmlClass) { XmlClass currentParentComponent = (XmlClass)Parent.Tag; XmlClass newParentComponent = newParent.XmlInstance; // if the two items are part of the same compoenent, indexes will be off XmlClass item = (XmlClass)Tag; // remove self from current parent currentParentComponent.Children.Remove(item); // add self to new parent newParentComponent.Children.Insert(index, item); // remove the current node Remove(); // insert to the parent node newParent.Nodes.Insert(index, this); this.EnsureVisible(); TreeView.SelectedNode = this; } }
public static XmlTreeNodeImpl CreateNode(XmlClass item) { XmlTreeNodeImpl node = null; if (item is ConfigFile) { node = new TreeNodeConfigFile(item as ConfigFile); } else if (item is SetupConfiguration) { node = new TreeNodeSetupConfguration(item as SetupConfiguration); } else if (item is WebConfiguration) { node = new TreeNodeWebConfguration(item as WebConfiguration); } else if (item is DownloadDialog) { node = new TreeNodeDownloadDialog(item as DownloadDialog); } else if (item is Download) { node = new TreeNodeDownload(item as Download); } else if (item is EmbedFile) { node = new TreeNodeEmbedFile(item as EmbedFile); } else if (item is EmbedFolder) { node = new TreeNodeEmbedFolder(item as EmbedFolder); } else if (item is ComponentCmd) { node = new TreeNodeComponentCmd(item as ComponentCmd); } else if (item is ComponentMsi) { node = new TreeNodeComponentMsi(item as ComponentMsi); } else if (item is ComponentMsu) { node = new TreeNodeComponentMsu(item as ComponentMsu); } else if (item is ComponentMsp) { node = new TreeNodeComponentMsp(item as ComponentMsp); } else if (item is ComponentOpenFile) { node = new TreeNodeComponentOpenFile(item as ComponentOpenFile); } else if (item is ComponentExe) { node = new TreeNodeComponentExe(item as ComponentExe); } else if (item is InstalledCheckFile) { node = new TreeNodenstalledCheckFile(item as InstalledCheckFile); } else if (item is InstalledCheckDirectory) { node = new TreeNodenstalledCheckDirectory(item as InstalledCheckDirectory); } else if (item is InstalledCheckRegistry) { node = new TreeNodenstalledCheckRegistry(item as InstalledCheckRegistry); } else if (item is InstalledCheckOperator) { node = new TreeNodeInstalledCheckOperator(item as InstalledCheckOperator); } else if (item is InstalledCheckProduct) { node = new TreeNodeInstalledCheckProduct(item as InstalledCheckProduct); } else if (item is ControlCheckBox) { node = new TreeNodeControlCheckbox(item as ControlCheckBox); } else if (item is ControlLabel) { node = new TreeNodeControlLabel(item as ControlLabel); } else if (item is ControlEdit) { node = new TreeNodeControlEdit(item as ControlEdit); } else if (item is ControlBrowse) { node = new TreeNodeControlBrowse(item as ControlBrowse); } else if (item is ControlLicense) { node = new TreeNodeControlLicense(item as ControlLicense); } else if (item is ControlHyperlink) { node = new TreeNodeControlHyperlink(item as ControlHyperlink); } else if (item is ControlImage) { node = new TreeNodeControlImage(item as ControlImage); } else { throw new Exception(string.Format("Unsupported type: {0}", item.GetType().Name)); } return(node); }