Пример #1
0
        private static void AddHistorianTags()
        {
            HistorianAccessError error;

            try
            {
                log.Info("Adding defined historian tags");

                // Add all of the tags.  Separate logic will check to make sure the tag is ready before writing
                foreach (subscription localSubscription in _HistorianTags.subscribetags.Where(s => s.useregex.Equals(false)))
                {
                    log.DebugFormat("Adding tag {0}", localSubscription.historianTag.TagName);
                    UInt32 tagKey;
                    if (!_historian.AddTag(localSubscription.historianTag, out tagKey, out error))
                    {
                        log.WarnFormat("Failed to request tag creation: {0}", error.ErrorDescription);
                    }
                    else
                    {
                        // Save off the tag key we get back
                        localSubscription.historianTag.TagKey = tagKey;
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }