Example #1
0
        private void PopulateLstRegistryKeys(List<RegValueData> values)
        {
            lstRegistryKeys.Items.Clear();

            // Make sure that the passed values are usable
            if (values != null && values.Count > 0)
            {
                foreach (var value in values)
                {
                    RegistryValueLstItem item = new RegistryValueLstItem(value.Name, value.GetKindAsString(), value.GetDataAsString());
                    lstRegistryKeys.Items.Add(item);
                }
            }
        }
Example #2
0
        public void AddValueToList(string keyPath, RegValueData value)
        {
            TreeNode key = GetTreeNode(keyPath);

            if (key != null )
            {
                lstRegistryKeys.Invoke((MethodInvoker)delegate
                {
                    List<RegValueData> ValuesFromNode = null;
                    if (key.Tag != null && key.Tag.GetType() == typeof(List<RegValueData>)) {
                        ValuesFromNode = (List<RegValueData>)key.Tag;
                        ValuesFromNode.Add(value);
                    }
                    else
                    {
                        //The tag has a incorrect element or is missing data
                        ValuesFromNode = new List<RegValueData>();
                        ValuesFromNode.Add(value);
                        key.Tag = ValuesFromNode;
                    }

                    //Deactivate sorting
                    lstRegistryKeys.Sorting = SortOrder.None;

                    if (tvRegistryDirectory.SelectedNode == key)
                    {
                        RegistryValueLstItem item = new RegistryValueLstItem(value.Name, value.GetKindAsString(), value.GetDataAsString());
                        //unselect all
                        lstRegistryKeys.SelectedIndices.Clear();
                        lstRegistryKeys.Items.Add(item);
                        item.Selected = true;
                        lstRegistryKeys.LabelEdit = true;
                        item.BeginEdit();
                    }
                    else
                    {
                        tvRegistryDirectory.SelectedNode = key;
                    }
                });
            }
        }