Ejemplo n.º 1
0
 private void allTvAddNode()
 {
     PssgNode parentNode = pssg.RootNode == null ? null : ((PssgNode)treeView.SelectedNode.Tag);
     using (AddBox aBox = new AddBox(pssg, 0))
     {
         if (aBox.ShowDialog() == DialogResult.OK)
         {
             PssgNode newNode;
             if (pssg.RootNode == null)
             {
                 newNode = new PssgNode(aBox.NodeName, pssg, null);
                 pssg.RootNode = newNode;
             }
             else
             {
                 newNode = parentNode.AppendChild(aBox.NodeName);
             }
             if (newNode == null)
             {
                 return;
             }
             TreeNode newTreeNode = pssg.CreateTreeViewNode(newNode);
             if (parentNode == null)
                 treeView.Nodes.Add(newTreeNode);
             else
                 treeView.SelectedNode.Nodes.Add(newTreeNode);
             treeView.SelectedNode = newTreeNode;
         }
     }
 }
Ejemplo n.º 2
0
 private void addAttributeToolStripMenuItem_Click(object sender, EventArgs e)
 {
     PssgNode parentNode = ((PssgNode)treeView.SelectedNode.Tag);
     using (AddBox aBox = new AddBox(pssg, 1))
     {
         if (aBox.ShowDialog() == DialogResult.OK)
         {
             if (parentNode.AddAttribute(aBox.AttributeName, Convert.ChangeType(aBox.Value, aBox.ValueType)) == null)
             {
                 return;
             }
             createView(parentNode);
         }
     }
 }