示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="oiv"></param>
        private MibNode AddToTree(ObjectIdentifierValue oiv)
        {
            MibNode parent;

            // Add parent node to tree (if needed)
            if (HasParent(oiv))
            {
                parent = AddToTree(oiv.Parent);
            }
            else
            {
                parent = rootNode;
            }

            // Check if node already added
            foreach (var node in parent.Nodes)
            {
                MibNode mibNode = node as MibNode;
                if (mibNode.Value.Equals(oiv))
                {
                    return(mibNode);
                }
            }

            // Create new node
            string  name    = oiv.Name + " (" + oiv.Value + ")";
            MibNode newNode = new MibNode(name, oiv);

            parent.Nodes.Add(newNode);
            nodes.Add(oiv.Symbol, newNode);
            return(newNode);
        }
示例#2
0
        private void treeMibs_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            MibNode n = e.Node as MibNode;

            if (n == null)
            {
                return;
            }

            string t = string.Join(
                "\r\n",
                n.Description
                .Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => s.Trim()));

            txtNodeInfo.Text = t;
        }