当前位置: 首页>>代码示例>>C#>>正文


C# Subscription.FindItemByClientHandle方法代码示例

本文整理汇总了C#中Subscription.FindItemByClientHandle方法的典型用法代码示例。如果您正苦于以下问题:C# Subscription.FindItemByClientHandle方法的具体用法?C# Subscription.FindItemByClientHandle怎么用?C# Subscription.FindItemByClientHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subscription的用法示例。


在下文中一共展示了Subscription.FindItemByClientHandle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

        /// <summary>
        /// Sets the nodes in the control.
        /// </summary>
        public void Initialize(Subscription subscription, MonitoredItem monitoredItem)
        {
            if (subscription == null) throw new ArgumentNullException("subscription");
            
            Clear();
                        
            // start receiving notifications from the new subscription.
            m_subscription  = subscription;
            m_monitoredItem = monitoredItem;

            // get the events.
            List<MonitoredItemNotification> changes = new List<MonitoredItemNotification>();

            foreach (NotificationMessage notification in m_subscription.Notifications)
            {
                foreach (MonitoredItemNotification change in notification.GetDataChanges(false))
                {
                    if (m_monitoredItem != null)
                    {
                        if (m_monitoredItem.ClientHandle != change.ClientHandle)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (m_subscription.FindItemByClientHandle(change.ClientHandle) == null)
                        {
                            continue;
                        }
                    }

                    changes.Add(change);

                    if (changes.Count >= MaxChangeCount)
                    {
                        break;
                    }
                }

                if (changes.Count >= MaxChangeCount)
                {
                    break;
                }
            }

            UpdateChanges(changes, 0);
            AdjustColumns();
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:52,代码来源:DataChangeNotificationListCtrl.cs

示例2: Initialize

        /// <summary>
        /// Sets the nodes in the control.
        /// </summary>
        public void Initialize(Subscription subscription, MonitoredItem monitoredItem)
        {
            if (subscription == null) throw new ArgumentNullException("subscription");
            
            Clear();
                        
            // start receiving notifications from the new subscription.
            m_subscription  = subscription;
            m_monitoredItem = monitoredItem;

            // get the events.
            List<EventFieldList> events = new List<EventFieldList>();

            foreach (NotificationMessage message in m_subscription.Notifications)
            {
                foreach (EventFieldList eventFields in message.GetEvents(true))
                {
                    if (m_monitoredItem != null)
                    {
                        if (m_monitoredItem.ClientHandle != eventFields.ClientHandle)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (m_subscription.FindItemByClientHandle(eventFields.ClientHandle) == null)
                        {
                            continue;
                        }
                    }
                    
                    events.Add(eventFields);

                    if (events.Count >= MaxEventCount)
                    {
                        break;
                    }
                }

                if (events.Count >= MaxEventCount)
                {
                    break;
                }
            }

            UpdateEvents(events, 0);
            AdjustColumns();
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:52,代码来源:EventNotificationListCtrl.cs

示例3: OnDataChange

        private void OnDataChange(Subscription subscription, DataChangeNotification notification, IList<string> stringTable)
        {
            if (!Object.ReferenceEquals(subscription, m_subscription))
            {
                return;
            }

            if (this.InvokeRequired)
            {
                this.BeginInvoke(new FastDataChangeNotificationEventHandler(OnDataChange), subscription, notification, stringTable);
                return;
            }

            try
            {
                foreach (MonitoredItemNotification itemNotification in notification.MonitoredItems)
                {
                    MonitoredItem monitoredItem = subscription.FindItemByClientHandle(itemNotification.ClientHandle);

                    if (monitoredItem == null)
                    {
                        continue;
                    }

                    DataRow row = (DataRow)monitoredItem.Handle;

                    if (row.RowState == DataRowState.Detached)
                    {
                        continue;
                    }

                    UpdateRow(row, itemNotification);

                    if (m_EditComplexValueDlg != null && Object.ReferenceEquals(m_EditComplexValueDlg.Tag, monitoredItem))
                    {
                        m_EditComplexValueDlg.UpdateValue(monitoredItem.ResolvedNodeId, monitoredItem.AttributeId, null, itemNotification.Value.Value);
                    }
                }
            }
            catch (Exception exception)
            {
                ClientUtils.HandleException(this.Text, exception);
            }
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:44,代码来源:SubscribeDataListViewCtrl.cs


注:本文中的Subscription.FindItemByClientHandle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。