Opc.Ua.Com.Client.AeTypeCache.LoadConditionEvent C# (CSharp) Method

LoadConditionEvent() private method

private LoadConditionEvent ( ComAeClient client, int eventTypeId, int categoryId, string description, List attributes ) : void
client ComAeClient
eventTypeId int
categoryId int
description string
attributes List
return void
        private void LoadConditionEvent(ComAeClient client, int eventTypeId, int categoryId, string description, List<EventAttribute> attributes)
        {
            string[] conditionNames = null;

            try
            {
                client.GetConditionNames(categoryId, out conditionNames);
            }
            catch (Exception e)
            {
                Utils.Trace(e, "Unexpected error fetching condition names.");
                conditionNames = null;
            }

            if (conditionNames != null)
            {
                // create a condition class for the category.
                EventType eventType = new EventType();
                eventType.EventTypeId = eventTypeId;
                eventType.CategoryId = categoryId;
                eventType.Description = description;
                eventType.ConditionName = null;
                eventType.SubConditionNames = null;
                eventType.Attributes = new List<EventAttribute>();
                DetermineMapping(eventType);
                EventTypes.Add(eventType);

                // create event types for each condition name.
                for (int ii = 0; ii < conditionNames.Length; ii++)
                {
                    eventType = new EventType();
                    eventType.EventTypeId = eventTypeId;
                    eventType.CategoryId = categoryId;
                    eventType.Description = description;
                    eventType.ConditionName = conditionNames[ii];
                    eventType.SubConditionNames = null;
                    eventType.Attributes = attributes;
                    DetermineMapping(eventType);

                    string[] subConditionNames = null;

                    try
                    {
                        client.GetSubConditionNames(eventType.ConditionName, out subConditionNames);
                    }
                    catch (Exception e)
                    {
                        Utils.Trace(e, "Unexpected error fetching sub-condition names.");
                        subConditionNames = null;
                    }

                    if (subConditionNames != null)
                    {
                        eventType.SubConditionNames = new List<string>(subConditionNames);
                    }

                    EventTypes.Add(eventType);
                }
            }
        }