本文整理汇总了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();
}
示例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();
}
示例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);
}
}