Ejemplo n.º 1
0
        /// <summary>
        /// Subentries are updated. Returns true, if at least one entry is added or removed.
        /// </summary>
        public bool IterateElements()
        {
            string newNodeHash      = ParameterDict.Current.GetHashOfName(_category);
            string newNodeValueHash = ParameterDict.Current.GetHash(_category);

            if (newNodeHash != _nodeHash)
            { // At least one entry is added or deleted, so everything must new created
                Create(_category);
                return(true);
            }
            if (newNodeValueHash != _nodeValueHash)
            { // At least one value has changed, so each subcontrol has to update itself
                foreach (UserControl subControl in Controls)
                {
                    if (subControl is DataViewElement)
                    {
                        DataViewElement dataView = (DataViewElement)subControl;
                        dataView.UpdateElements();
                    }
                }
                _nodeValueHash = ParameterDict.Current.GetHash(_category);
                return(false);
            }
            // If nothing has changed, nothing has to update.
            return(false);
        }
Ejemplo n.º 2
0
 public void UpdateElements()
 {
     foreach (UserControl subControl in Controls)
     {
         if (subControl is DataViewElement)
         {
             DataViewElement dataView = (DataViewElement)subControl;
             dataView.UpdateElements();
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Control ist filled with all entries which corresponds to given names.
        /// </summary>
        public void Create(string[] entryNames)
        {
            this.Dock = DockStyle.Fill;
            // Contain the edit entries before adding to the control
            List <DataViewElement> oldElements = new List <DataViewElement>();

            this.SuspendLayout();
            foreach (string parameterName in entryNames)
            {
                DataViewElement dElement = DataViewElementFactory.Create(parameterName, ParameterDict.Current.SortedEntries[parameterName], ParameterDict.Current.GetDatatype(parameterName),
                                                                         ParameterDict.Current.GetDescription(parameterName), true);
                dElement.ElementChanged += new ElementChangedDelegate(_parent.dElement_ElementChanged);
                oldElements.Add(dElement);
                dElement.TabIndex = oldElements.Count;
                _computedHeight  += DataViewElementFactory.DefaultHeight;
            }
            for (int i = oldElements.Count - 1; i >= 0; i--)
            {
                DataViewElement dElement = oldElements[i];
                Controls.Add(dElement);
            }
            this.ResumeLayout(true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Control ist filled with all entries which corresponds to the given category.
        /// </summary>
        public void Create(string category)
        {
            this.Dock = DockStyle.Fill;

            _category      = category;
            _nodeHash      = ParameterDict.Current.GetHashOfName(category);
            _nodeValueHash = ParameterDict.Current.GetHash(category);

            // Contain the edit entries before adding to the control
            List <DataViewElement> oldElements = new List <DataViewElement>();

            this.SuspendLayout();
            _computedHeight = 0;
            bool elementAdded = false;

            {
                DataViewElement helement = DataViewElementFactory.Create(category.Replace(".", " "), "", "Headline", "", false);
                oldElements.Add(helement);
                _computedHeight += DataViewElementFactory.DefaultHeight;
            }


            foreach (KeyValuePair <string, string> entry in ParameterDict.Current.SortedEntries)
            {
                string parameterName = entry.Key;
                if (parameterName.StartsWith(category + ".") && ParameterDict.HasControl(parameterName))
                {
                    if (parameterName.Length > category.Length)
                    {
                        string tempName = parameterName.Substring(category.Length + 1);
                        if (!tempName.Contains("."))
                        {
                            DataViewElement dElement = DataViewElementFactory.Create(parameterName, entry.Value, ParameterDict.Current.GetDatatype(parameterName),
                                                                                     ParameterDict.Current.GetDescription(parameterName), true);
                            dElement.ElementChanged += new ElementChangedDelegate(_parent.dElement_ElementChanged);
                            oldElements.Add(dElement);
                            dElement.TabIndex = oldElements.Count;
                            _computedHeight  += DataViewElementFactory.DefaultHeight;
                            elementAdded      = true;
                        }
                    }
                }
            }

            // Wenn kein direktes Unterelement existiert, werden alle Unterelemente eingefügt.
            string currentCategory = "";
            string oldCategory     = "";

            if (!elementAdded)
            {
                // Header:


                foreach (KeyValuePair <string, string> entry in ParameterDict.Current.SortedEntries)
                {
                    string parameterName = entry.Key;
                    if (parameterName.StartsWith(category) && ParameterDict.HasControl(parameterName) && !ParameterDict.IsAdditionalInfo(parameterName))
                    {
                        string[] paraSplit = parameterName.Split('.');
                        if (paraSplit.Length > 1)
                        {
                            currentCategory = paraSplit[paraSplit.Length - 2];
                            if (currentCategory != oldCategory)
                            {
                                /*
                                 * //DataViewElement helement = DataViewElementFactory.Create(currentCategory, "", "Headline", "", false);
                                 * DataViewElement helement = DataViewElementFactory.Create("", "", "Headline", "", false);
                                 * oldElements.Add(helement);
                                 */

                                oldCategory      = currentCategory;
                                _computedHeight += DataViewElementFactory.DefaultHeight;
                            }
                        }
                        DataViewElement dElement = DataViewElementFactory.Create(parameterName, entry.Value, ParameterDict.Current.GetDatatype(parameterName), ParameterDict.Current.GetDescription(parameterName), true);
                        dElement.ElementChanged += new ElementChangedDelegate(_parent.dElement_ElementChanged);
                        oldElements.Add(dElement);
                        dElement.TabIndex = oldElements.Count;
                        _computedHeight  += DataViewElementFactory.DefaultHeight;
                    }
                }
            }
            for (int i = oldElements.Count - 1; i >= 0; i--)
            {
                DataViewElement dElement = oldElements[i];
                Controls.Add(dElement);
            }
            this.ResumeLayout(true);
        }