Exemple #1
0
        /// <summary>
        /// Updates categories with selected attributes to dictionary.
        /// </summary>
        private void SetSelectedCategories(TreeNode parent, Technosoftware.DaAeHdaClient.Ae.TsCAeAttributeDictionary attributes)
        {
            foreach (TreeNode child in parent.Nodes)
            {
                if (!typeof(Technosoftware.DaAeHdaClient.Ae.TsCAeCategory).IsInstanceOfType(child.Tag))
                {
                    continue;
                }

                // check if category exists.
                Technosoftware.DaAeHdaClient.Ae.TsCAeCategory category = (Technosoftware.DaAeHdaClient.Ae.TsCAeCategory)child.Tag;

                if (!attributes.Contains(category.ID))
                {
                    child.Checked = false;
                    continue;
                }

                // check if attributes need to be fetched.
                if (child.Nodes.Count == 1 && child.Nodes[0].Text.Length == 0)
                {
                    child.Nodes.Clear();
                    ShowEventAttributes(child.Nodes, category);
                }

                // update individual attributes.
                SetSelectedAttributes(child, category, attributes);
            }
        }
Exemple #2
0
 /// <summary>
 /// Sets the currently selected attributes.
 /// </summary>
 public void SetSelectedAttributes(Technosoftware.DaAeHdaClient.Ae.TsCAeAttributeDictionary attributes)
 {
     foreach (TreeNode child in attributesTv_.Nodes)
     {
         SetSelectedCategories(child, attributes);
     }
 }
Exemple #3
0
        /// <summary>
        /// Returns currently selected attributes
        /// </summary>
        public Technosoftware.DaAeHdaClient.Ae.TsCAeAttributeDictionary GetSelectedAttributes()
        {
            Technosoftware.DaAeHdaClient.Ae.TsCAeAttributeDictionary attributes = new Technosoftware.DaAeHdaClient.Ae.TsCAeAttributeDictionary();

            foreach (TreeNode child in attributesTv_.Nodes)
            {
                GetSelectedCategories(child, attributes);
            }

            return(attributes);
        }
Exemple #4
0
        /// <summary>
        /// Adds categories with selected attributes to dictionary.
        /// </summary>
        private void GetSelectedCategories(TreeNode parent, Technosoftware.DaAeHdaClient.Ae.TsCAeAttributeDictionary attributes)
        {
            foreach (TreeNode child in parent.Nodes)
            {
                if (!typeof(Technosoftware.DaAeHdaClient.Ae.TsCAeCategory).IsInstanceOfType(child.Tag))
                {
                    continue;
                }

                GetSelectedAttributes(child, (Technosoftware.DaAeHdaClient.Ae.TsCAeCategory)child.Tag, attributes);
            }
        }
        /// <summary>
        /// Returns a writable copy of the current attributes.
        /// </summary>
        public TsCAeAttributeDictionary GetAttributes()
        {
            LicenseHandler.ValidateFeatures(LicenseHandler.ProductFeature.AlarmsConditions);
            TsCAeAttributeDictionary attributes = new TsCAeAttributeDictionary();

            IDictionaryEnumerator enumerator = attributes_.GetEnumerator();

            while (enumerator.MoveNext())
            {
                if (enumerator.Key != null)
                {
                    var categoryId = (int)enumerator.Key;
                    AttributeCollection attributeIDs = (AttributeCollection)enumerator.Value;

                    attributes.Add(categoryId, attributeIDs.ToArray());
                }
            }

            return(attributes);
        }
Exemple #6
0
        /// <summary>
        /// Updates the selected attributes to the dictionary.
        /// </summary>
        private void SetSelectedAttributes(TreeNode parent, Technosoftware.DaAeHdaClient.Ae.TsCAeCategory category, Technosoftware.DaAeHdaClient.Ae.TsCAeAttributeDictionary attributes)
        {
            foreach (TreeNode child in parent.Nodes)
            {
                if (!typeof(TsCAeAttribute).IsInstanceOfType(child.Tag))
                {
                    continue;
                }

                Technosoftware.DaAeHdaClient.Ae.TsCAeAttribute attribute = (Technosoftware.DaAeHdaClient.Ae.TsCAeAttribute)child.Tag;

                if (attributes[category.ID].Contains(attribute.ID))
                {
                    child.Checked = true;
                }
                else
                {
                    child.Checked = false;
                }
            }
        }
Exemple #7
0
        /// <summary>
        /// Adds selected attributes to the dictionary.
        /// </summary>
        private void GetSelectedAttributes(TreeNode parent, Technosoftware.DaAeHdaClient.Ae.TsCAeCategory category, Technosoftware.DaAeHdaClient.Ae.TsCAeAttributeDictionary attributes)
        {
            foreach (TreeNode child in parent.Nodes)
            {
                if (!typeof(Technosoftware.DaAeHdaClient.Ae.TsCAeAttribute).IsInstanceOfType(child.Tag))
                {
                    continue;
                }

                if (child.Checked)
                {
                    Technosoftware.DaAeHdaClient.Ae.TsCAeAttributeCollection collection = attributes[category.ID];

                    if (collection == null)
                    {
                        attributes.Add(category.ID, null);
                        collection = attributes[category.ID];
                    }

                    collection.Add(((Technosoftware.DaAeHdaClient.Ae.TsCAeAttribute)child.Tag).ID);
                }
            }
        }