Пример #1
0
        private void Browse(ReferenceDescriptionCollection references)
        {
            ReferenceDescriptionCollection r;

            Byte[] continuationPoint;
            foreach (var node in references.Where(o => o.DisplayName.Text != "Server"))
            {
                if (node.NodeClass == NodeClass.Variable)
                {
                    if (items.Any(o => o.Key == node.NodeId.ToString().ToUpper()))
                    {
                        var monitoredItem = new MonitoredItem(m_subscription.DefaultItem)
                        {
                            DisplayName = node.DisplayName.Text, StartNodeId = (NodeId)node.NodeId
                        };
                        monitoredItem.Notification += OnValueChange;
                        m_subscription.AddItem(monitoredItem);
                        OnStatusMessage(MessageLevel.Info, $"OPC item {node.NodeId} linked.");
                    }
                }
                else if (node.NodeClass == NodeClass.Object)
                {
                    m_session.Browse(null, null, (NodeId)node.NodeId, 0u, BrowseDirection.Forward, ReferenceTypeIds.HierarchicalReferences, true, (uint)NodeClass.Variable | (uint)NodeClass.Object | (uint)NodeClass.Method, out continuationPoint, out r);
                    Browse(r);
                }
            }
        }