public TreeNode AddNamespace(TreeNode parent, Namespace ns) { return AddNode(NodeType.Namespace, parent, ns.Name, new TreeNodeMetaData() { Namespace = ns }); }
private void LoadNamespace(TreeNode parent, Namespace _namespace) { foreach (var ns in _namespace.Namespaces) LoadNamespace(AddNamespace(parent, ns), ns); foreach (var cls in _namespace.Classes) AddClass(parent, cls); foreach (var intf in _namespace.Interfaces) AddInterface(parent, intf); }
public AddClass(NodeType nodeType, Namespace parent) { InitializeComponent(); Text = "Add " + (nodeType == NodeType.Class ? "Class" : nodeType == NodeType.Abstract ? "Abstract" : "Interface"); if (nodeType == NodeType.Interface) cxCtor.Enabled = false; NsParent = parent; foreach (var ac in nodeType == NodeType.Interface ? Interface.AllowedAccessibilities : Class.AllowedAccessibilities) cbAccess.Items.Add(ac); cbAccess.SelectedItem = nodeType == NodeType.Interface ? Interface.DefaultAccessibility : Class.DefaultAccessibility; }
private void btnAddParam_Click(object sender, EventArgs e) { AddNamespace an = new AddNamespace(Tree.GetNamespace(tvProject.SelectedNode)); if (an.ShowDialog(this) == DialogResult.OK) { Namespace ns = new Namespace() { Name = an.Namespace }; Tree.GetNamespace(tvProject.SelectedNode)?.Namespaces.Add(ns); Program.Db.SaveChanges(); Tree.AddNamespace(tvProject.SelectedNode, ns); tvProject.SelectedNode.Expand(); } an.Dispose(); }
public AddNamespace(Namespace parent) { InitializeComponent(); NsParent = parent; }