Exemplo n.º 1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Stop();

            TreeNode treeNode = tvwNodes.SelectedNode;

            if (DisplayedNode != treeNode)
            {
                if (treeNode?.Tag is object node)
                {
                    Visualizer visualizer = NodeVisualizer.GetVisualizer(node);
                    Debug.Assert(visualizer != null);
                    lblType.Text = node.GetType().Name;
                    visualizer.PopulateProperties(node, lvwProperties);
                    txtText.Text = visualizer.LongDescription(node);
                }
                else
                {
                    lblType.Text = string.Empty;
                    lvwProperties.Columns.Clear();
                    lvwProperties.Items.Clear();
                    txtText.Text = string.Empty;
                }
                DisplayedNode = treeNode;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Populates TreeView control with nodes
 /// </summary>
 /// <param name="nodes"></param>
 /// <param name="parent"></param>
 public void LoadNodes(HtmlNodeCollection nodes, TreeNode parent)
 {
     // Populate
     foreach (HtmlNode node in nodes)
     {
         Visualizer visualizer = NodeVisualizer.GetVisualizer(node);
         Debug.Assert(visualizer != null);
         TreeNode treeNode = parent.Nodes.Add(visualizer.ShortDescription(node));
         treeNode.Tag        = node;
         treeNode.ImageIndex = treeNode.SelectedImageIndex = GetImageIndex(node);
         if (node is HtmlElementNode elementNode)
         {
             LoadNodes(elementNode.Children, treeNode);
         }
     }
 }