示例#1
0
        /// <summary>
        /// 获取所有节点,包括变量
        /// </summary>
        private void GetAllNode()
        {
            _Nav = new NavModal();
            ReferenceDescriptionCollection referenceDescriptionCollection = uAClient.BrowseRoot();

            GetNodes(referenceDescriptionCollection, _Nav);
        }
示例#2
0
 private void GetSysTags(NavModal modal)
 {
     if (modal == null)
     {
         throw new ArgumentNullException();
     }
     if (modal.Node?.NodeClass == NodeClass.Variable)           //这是一个变量
     {
         if (!modal.Node.NodeId.ToString().StartsWith("i"))     //过滤掉i=8 开头的
         {
             if (modal.Node.DisplayName.Text.StartsWith("_"))   //过滤掉系统变量
             {
                 _ServerSysTags.Add(new TagItem()
                 {
                     Id        = Guid.NewGuid().ToString(),
                     ServerId  = modal.Node.NodeId.Identifier.ToString(),
                     NodeId    = modal.Node.NodeId.ToString(),
                     NameSpace = modal.Node.NodeId.NamespaceIndex.ToString(),
                     Name      = modal.Node.DisplayName.Text
                 });
             }
         }
     }
     if (modal.Children.Count > 0)
     {
         foreach (var m in modal.Children)
         {
             GetSysTags(m);
         }
     }
 }
示例#3
0
 private void GetNodes(ReferenceDescriptionCollection refDes, NavModal parent)
 {
     //parent 上一层的modal
     for (int i = 0; i < refDes.Count; i++)
     {
         NavModal thisModal = new NavModal()
         {
             Id     = Guid.NewGuid().ToString(),
             Node   = new Node(refDes[i]),
             Parent = parent
         };
         parent.Children.Add(thisModal);
         if (refDes[i].NodeClass == NodeClass.Variable)
         {
             continue;
         }
         ReferenceDescriptionCollection collection = uAClient.BrowseNode(refDes[i]);
         if (collection.Count > 0)
         {
             GetNodes(collection, thisModal);
         }
     }
 }