Пример #1
0
 private void AddNode(Node node, AdvTree advTree)
 {
     advTree.BeginUpdate();
     advTree.Nodes.Add(node);
     advTree.EndUpdate();
 }
Пример #2
0
 private void ClearTree(AdvTree advTree)
 {
     advTree.BeginUpdate();
     advTree.Nodes.Clear();
     advTree.EndUpdate(true);
 }
Пример #3
0
		/// <summary>
		/// Load nodes from XmlElement.
		/// </summary>
		/// <param name="tree">Reference to AdvTree to be populated.</param>
		/// <param name="parent">XmlElement that tree was serialized to.</param>
		public static void Load(AdvTree tree, XmlElement parent)
		{
			tree.BeginUpdate();
			tree.DisplayRootNode = null;
			tree.Nodes.Clear();
			
			NodeSerializationContext context = new NodeSerializationContext();
			context.AdvTree = tree;
			context.HasDeserializeNodeHandlers  = tree.HasDeserializeNodeHandlers;
			context.HasSerializeNodeHandlers = tree.HasSerializeNodeHandlers;
			
			try
			{
				foreach(XmlNode xmlNode in parent.ChildNodes)
				{
					if(xmlNode.Name==XmlNodeName && xmlNode is XmlElement)
					{
						Node node=new Node();
						tree.Nodes.Add(node);
						context.RefXmlElement = xmlNode as XmlElement;
						LoadNode(node, context);
					}
				}
			}
			finally
			{
				tree.EndUpdate();
			}
		}