示例#1
0
文件: Save.cs 项目: akinomyoga/hnk
        public void CreateAfter(string name)
        {
            //--create
            System.Xml.XmlElement elem = this.OwnerDocument.CreateElement("F");
            elem.SetAttribute("name", name);
            File newfile = new File(elem);
            //--search target
            File tgfile = this.Parent;

            System.Xml.XmlElement tgelem = tgfile != null?tgfile.Element:OwnerDocument.DocumentElement;
            //--insert
            tgelem.InsertAfter(newfile.Element, this.Element);
            if (tgfile == null)
            {
                OwnerDocument.RefreshFiles();
                if (this.TreeView != null)
                {
                    this.TreeView.Nodes.Insert(this.Index + 1, newfile);
                    //MemoTreeView tv=this.TreeView as MemoTreeView;
                    //if(tv!=null)tv.RefreshFiles();
                }
            }
            else
            {
                tgfile.Nodes.Insert(this.Index + 1, newfile);
            }
        }