コード例 #1
0
        public TagTreeNode AddNode(string name)
        {
            TagTreeNode node = new TagTreeNode(name);

            node.Parent = this;
            this.nodes.Add(node);
            return(node);
        }
コード例 #2
0
        /// <summary>
        /// 显示节点树 不包含叶子节点
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public TagTreeNode GetTree(TagTreeNode node)
        {
            TagTreeNode subNode = null;

            opcBrowser.ShowBranches();

            foreach (var branch in opcBrowser)
            {
                if (node == null)
                {
                    node = new TagTreeNode(opcServer.ServerName);
                }
                //Console.WriteLine(branch);
                subNode = node.AddNode(branch.ToString());
                try
                {
                    opcBrowser.MoveDown(branch.ToString());
                    GetTree(subNode);
                    opcBrowser.MoveUp();
                }
                catch { }
            }
            return(node);
        }