Esempio n. 1
0
        private void UpdateTree()
        {
            string        s = m_zobObjectManagerWrapper.GetZobObjectList();
            ZobObjectTree z = JsonConvert.DeserializeObject <ZobObjectTree>(s);

            //ZobObjectTree.Nodes.Clear();
            AddNode(z, null);
            ZobObjectTree.ExpandAll();
        }
Esempio n. 2
0
        private void ZobObjectTree_MouseClick(object sender, MouseEventArgs e)
        {
            //TreeNode n = ZobObjectTree.SelectedNode;
            TreeNode n = ZobObjectTree.GetNodeAt(e.X, e.Y);

            ZobObjectTree.SelectedNode = n;
            if (e.Button == MouseButtons.Right && n != null && n.ContextMenuStrip != null)
            {
                n.ContextMenuStrip.Show();
            }
        }
Esempio n. 3
0
 private void AddNode(ZobObjectTree z, TreeNode p)
 {
     if (z != null)
     {
         TreeNode n = null;
         if (p != null)
         {
             if (!p.Nodes.ContainsKey(z.name))
             {
                 n = p.Nodes.Add(z.name, z.name);
                 n.ContextMenuStrip = TreeNodeRightClick;
             }
             else
             {
                 n = p.Nodes[z.name];
             }
         }
         else
         {
             if (!ZobObjectTree.Nodes.ContainsKey(z.name))
             {
                 n = ZobObjectTree.Nodes.Add(z.name, z.name);
                 n.ContextMenuStrip = TreeNodeRightClick;
             }
             else
             {
                 n = ZobObjectTree.Nodes[z.name];
             }
         }
         if (z.children != null)
         {
             for (int i = 0; i < z.children.Length; i++)
             {
                 AddNode(z.children[i], n);
             }
         }
     }
 }