Exemple #1
0
        private void tvwSections_AfterSelect(object sender, TreeViewEventArgs e)
        {
            ModuleProc PROC = new ModuleProc("", "tvwSections_AfterSelect");

            try
            {
                _selectedClass = e.Node.Tag as RegClassName;
                var items = _config.KeyValues[_selectedClass.RefKeyName];

                CustomClass values = new CustomClass();
                foreach (var item in items)
                {
                    object         value = _config.GetObjectValue(_selectedClass.RefKeyName, item.Key);
                    CustomProperty kv    = new CustomProperty(item.Key, value, false, true);
                    values.Add(kv);
                }

                pgrdKeyValues.SelectedObject = values;
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
Exemple #2
0
        private void cboInstallationTypes_SelectedIndexChanged(object sender, EventArgs e)
        {
            ModuleProc PROC = new ModuleProc("", "cboInstallationTypes_SelectedIndexChanged");

            try
            {
                ComboBoxItem <string> cbItem = cboInstallationTypes.SelectedItem as ComboBoxItem <string>;
                _config = ConfigApplicationFactory.Get(cbItem.Value);
                ConfigKeyValuePairTopDictionary keyValues = _config.KeyValues;
                _classRoot     = null;
                _selectedClass = null;
                tvwSections.Nodes.Clear();

                // find the class hierarchy
                char[]        dirChars    = new char[] { '\\' };
                RegClassNames classNames  = new RegClassNames();
                RegClassName  classParent = null;
                foreach (var pair1 in keyValues)
                {
                    string[] values = pair1.Key.Split(dirChars);
                    foreach (string value in values)
                    {
                        if (!classNames.ContainsKey(value))
                        {
                            RegClassName child = new RegClassName(value);
                            child.RefKeyName = pair1.Key;

                            TreeNode node = new TreeNode(child.ClassName, 2, 2);
                            child.Node = node;
                            node.Tag   = child;

                            if (classParent != null)
                            {
                                classParent.Children.Add(child);
                            }
                            classNames.Add(value, child);

                            if (classParent == null)
                            {
                                _classRoot = child;
                                tvwSections.Nodes.Add(node);
                            }
                            else
                            {
                                classParent.Node.Nodes.Add(node);
                                classParent = child;
                            }
                        }
                        else
                        {
                            classParent = classNames[value];
                        }
                    }
                }

                if (tvwSections.Nodes.Count > 0)
                {
                    tvwSections.Nodes[0].ExpandAll();
                    tvwSections.SelectedNode = tvwSections.Nodes[0];
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }