protected void MenuNewNamespaceHandler(object sender, SnapinNode node) { // Show the form. NewNamespaceWizard wizard = new NewNamespaceWizard(m_catalogue); if (wizard.Show() != DialogResult.OK) { return; } try { // Add the element. Namespace newNamespace = null; bool cont = true; while (cont) { newNamespace = wizard.Namespace; try { m_catalogue.Add(newNamespace); } catch (System.Exception e) { new ExceptionDialog(e, "Cannot add the namespace.").ShowDialog(); // Show it again. if (wizard.Show(newNamespace) != DialogResult.OK) { return; } cont = true; continue; } m_catalogue.Commit(); cont = false; } // Update the display. NamespaceNode newNode = new NamespaceNode(Snapin, newNamespace); InsertChildNode(newNode); newNode.Select(); newNode.Refresh(false); } catch (System.Exception ex) { new ExceptionDialog(ex, "The following exception has occurred:").ShowDialog(); } }
protected override SnapinNode[] GetChildNodes() { // Iterate through namespaces. SnapinNode[] nodes = new SnapinNode[m_catalogue.Namespaces.Count]; int index = 0; foreach (Namespace ns in m_catalogue.Namespaces) { nodes[index++] = new NamespaceNode(Snapin, ns); } return(nodes); }
protected override SnapinNode[] GetChildNodes() { // Iterate. SnapinNode[] nodes = new SnapinNode[m_namespace.Namespaces.Count + m_namespace.Sources.Count]; int index = 0; foreach (Namespace ns in m_namespace.Namespaces) { nodes[index++] = new NamespaceNode(Snapin, ns); } foreach (Source source in m_namespace.Sources) { nodes[index++] = new SourceNode(Snapin, source); } return(nodes); }