示例#1
0
 public void AddAt(int index, TreeNode child)
 {
     if (child == null)
     {
         throw new ArgumentNullException("child");
     }
     if (this._updateParent)
     {
         if ((child.Owner != null) && (child.Parent == null))
         {
             child.Owner.Nodes.Remove(child);
         }
         if (child.Parent != null)
         {
             child.Parent.ChildNodes.Remove(child);
         }
         if (this._owner != null)
         {
             child.SetParent(this._owner);
             child.SetOwner(this._owner.Owner);
         }
     }
     this._list.Insert(index, child);
     this._version++;
     if (this._isTrackingViewState)
     {
         ((IStateManager)child).TrackViewState();
         child.SetDirty();
     }
     this.Log.Add(new LogItem(LogItemType.Insert, index, this._isTrackingViewState));
 }
 public void AddAt(int index, TreeNode child)
 {
     if (child == null)
     {
         throw new ArgumentNullException("child");
     }
     if (this._updateParent)
     {
         if ((child.Owner != null) && (child.Parent == null))
         {
             child.Owner.Nodes.Remove(child);
         }
         if (child.Parent != null)
         {
             child.Parent.ChildNodes.Remove(child);
         }
         if (this._owner != null)
         {
             child.SetParent(this._owner);
             child.SetOwner(this._owner.Owner);
         }
     }
     this._list.Insert(index, child);
     this._version++;
     if (this._isTrackingViewState)
     {
         ((IStateManager) child).TrackViewState();
         child.SetDirty();
     }
     this.Log.Add(new LogItem(LogItemType.Insert, index, this._isTrackingViewState));
 }
		public void Add (TreeNode child)
		{
			child.Index = items.Add (child);
			child.Tree = tree;
			child.SetParent (parent);
			if (marked) {
				child.TrackViewState ();
				child.SetDirty ();
				dirty = true;
			}
		}
		public void AddAt (int index, TreeNode child)
		{
			items.Insert (index, child);
			child.Index = index;
			child.Tree = tree;
			child.SetParent (parent);
			for (int n=index+1; n<items.Count; n++)
				((TreeNode)items[n]).Index = n;
			if (marked) {
				child.TrackViewState ();
				child.SetDirty ();
				dirty = true;
			}
		}