示例#1
0
        private void listViewFilters_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            RegistryViewerFilterEntry entry = (RegistryViewerFilterEntry)e.Item.Tag;

            entry.Enabled = e.Item.Checked;
            OnFilterChanged();
        }
示例#2
0
        private static ListViewItem CreateItem(RegistryViewerFilterEntry entry)
        {
            ListViewItem item = new ListViewItem(entry.Type.ToString(), entry.Decision == FilterDecision.Include ? 1 : 0);

            item.SubItems.Add(entry.Field.ToString());
            item.SubItems.Add(entry.Comparison.ToString());
            item.SubItems.Add(entry.Value);
            item.Checked = entry.Enabled;
            item.Tag     = entry.Clone();
            return(item);
        }
示例#3
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            if (listViewFilters.SelectedIndices.Count > 0)
            {
                RegistryViewerFilterEntry entry = (RegistryViewerFilterEntry)listViewFilters.SelectedItems[0].Tag;
                listViewFilters.Items.RemoveAt(listViewFilters.SelectedIndices[0]);
                UpdateInputForEntry(entry);

                OnFilterChanged();
            }
        }
示例#4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            RegistryViewerFilterEntry entry = new RegistryViewerFilterEntry();

            entry.Type       = (FilterType)comboBoxFilterType.SelectedItem;
            entry.Field      = ((PropertyInfo)comboBoxField.SelectedItem).Name;
            entry.Enabled    = true;
            entry.Decision   = (FilterDecision)comboBoxDecision.SelectedItem;
            entry.Comparison = (FilterComparison)comboBoxFilterComparison.SelectedItem;
            entry.Value      = comboBoxValue.Text;
            listViewFilters.Items.Add(CreateItem(entry));
            listViewFilters.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            listViewFilters.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            listViewFilters.Sort();
            OnFilterChanged();
        }
示例#5
0
        private void UpdateInputForEntry(RegistryViewerFilterEntry entry)
        {
            bool in_list = false;

            foreach (FilterType type in comboBoxFilterType.Items)
            {
                if (entry.Type == type)
                {
                    in_list = true;
                    break;
                }
            }

            if (!in_list)
            {
                return;
            }

            in_list = false;
            comboBoxFilterType.SelectedItem = entry.Type;
            foreach (PropertyInfo pi in comboBoxField.Items)
            {
                if (pi.Name == entry.Field)
                {
                    comboBoxField.SelectedItem = pi;
                    in_list = true;
                    break;
                }
            }

            if (!in_list)
            {
                return;
            }

            comboBoxFilterComparison.SelectedItem = entry.Comparison;
            comboBoxValue.Text            = entry.Value;
            comboBoxDecision.SelectedItem = entry.Decision;
        }