Esempio n. 1
0
        public void AddComment(XmlCommentTreeNode oNewXmlCommentTreeNode)
        {
            int      nI        = 0;
            TreeNode tselected = null;

            foreach (TreeNode t in this.SelectedNode.Nodes)
            {
                if (t is XmlElementTreeNode)
                {
                    if (nI == 0)
                    {
                        tselected = t;
                        nI       += 1;
                    }
                }
            }
            if (tselected != null)
            {
                this.SelectedNode.Nodes.Insert(tselected.Index, oNewXmlCommentTreeNode);
                this.SelectedNode = oNewXmlCommentTreeNode;
            }
            else
            {
                this.SelectedNode.Nodes.Add(oNewXmlCommentTreeNode);
                this.SelectedNode = oNewXmlCommentTreeNode;
            }
            Updated = true;
        }
Esempio n. 2
0
 public void InsertCommentAfter(XmlCommentTreeNode oNewXmlCommentTreeNode)
 {
     if (this.SelectedNode is XmlCommentTreeNode)
     {
         if (this.SelectedNode.Parent == null)
         {
             this.Nodes.Insert(this.SelectedNode.Index + 1, oNewXmlCommentTreeNode);
         }
         else
         {
             this.SelectedNode.Parent.Nodes.Insert(this.SelectedNode.Index + 1, oNewXmlCommentTreeNode);
         }
         this.SelectedNode = oNewXmlCommentTreeNode;
     }
     if (this.SelectedNode is XmlElementTreeNode || this.SelectedNode is XmlDeclarationTreeNode)
     {
         if (this.SelectedNode.Level == 0)
         {
             // insertbefore element
             if (HasXmlElementTreeNode())
             {
                 TreeNode oTreeNodeBase = GetXmlElementTreeNode();
                 if (oTreeNodeBase != null)
                 {
                     this.Nodes.Insert(oTreeNodeBase.Index, oNewXmlCommentTreeNode);
                     this.SelectedNode = oNewXmlCommentTreeNode;
                 }
             }
             else
             {
                 this.Nodes.Add(oNewXmlCommentTreeNode);
                 this.SelectedNode = oNewXmlCommentTreeNode;
             }
         }
         else
         {
             TreeNode oTreeNodeBase = GetXmlElementTreeNode();
             if (oTreeNodeBase != null)
             {
                 this.SelectedNode.Nodes.Insert(oTreeNodeBase.Index + 1, oNewXmlCommentTreeNode);
             }
             else
             {
                 this.SelectedNode.Nodes.Insert(this.SelectedNode.FirstNode.Index, oNewXmlCommentTreeNode);
             }
             this.SelectedNode = oNewXmlCommentTreeNode;
         }
     }
     Updated = true;
 }
Esempio n. 3
0
        public XmlCommentTreeNode CreateComment(string Value)
        {
            XmlCommentTreeNode oXmlCommentTreeNode = new XmlCommentTreeNode(Value, 4, 4);

            return(oXmlCommentTreeNode);
        }