Esempio n. 1
0
 public void SubscribeTag(ITag TagToSubscribe, int EventMaxFrequency = 0, int MaxDelayToFireEvent = 0, Action <ITag> OnTagValueChangeAction = null)
 {
     if (!TagSubscriptionDictionary.ContainsKey(TagToSubscribe.Name))
     {
         OPCTag T = TagToSubscribe as OPCTag;
         TagSubscriptionDictionary.Add(TagToSubscribe.Name, TagToSubscribe as OPCTag);
         T.SetToSubscription(EventMaxFrequency, MaxDelayToFireEvent, OnTagValueChangeAction);
     }
     CreateSubscription();
 }
Esempio n. 2
0
 public void SubscribeTags(List <string> TagsToSubscribeNames, int EventMaxFrequency = 0, int MaxDelayToFireEvent = 0, Action <ITag> OnTagValueChangeAction = null)
 {
     foreach (string item in TagsToSubscribeNames)
     {
         if (!TagSubscriptionDictionary.ContainsKey(item))
         {
             OPCTag T = (OPCTag)GetTag(item);
             if (T != null)
             {
                 TagSubscriptionDictionary.Add(T.Name, T);
                 T.SetToSubscription(EventMaxFrequency, MaxDelayToFireEvent, OnTagValueChangeAction);
             }
         }
     }
     CreateSubscription();
 }
Esempio n. 3
0
        public void SubscribeTags(List <ITag> TagsToSubscribe, int EventMaxFrequency = 0, int MaxDelayToFireEvent = 0, Action <ITag> OnTagValueChangeAction = null)
        {
            int SubscribedTagsN = 0;

            if (TagsToSubscribe.Count > 0)
            {
                foreach (var item in TagsToSubscribe)
                {
                    if (!TagSubscriptionDictionary.ContainsKey(item.Name))
                    {
                        OPCTag T = item as OPCTag;
                        TagSubscriptionDictionary.Add(T.Name, T);
                        T.SetToSubscription(EventMaxFrequency, MaxDelayToFireEvent, OnTagValueChangeAction);
                    }
                }
                CreateSubscription();
                Logger?.LogDebug($"OPC - Tag Subscription - Added to subscription: {SubscribedTagsN} Tags. Event max frequency:{EventMaxFrequency}. Total tags in subscription: {TagSubscriptionDictionary.Count()}");
            }
        }