예제 #1
0
 private void editBtn_Click(object sender, EventArgs e)
 {
     if (filterListBox.SelectedIndex != -1)
     {
         int    index        = filterListBox.SelectedIndex;
         Filter filterToEdit = null;
         foreach (Filter filter in Filters)
         {
             if (filterListBox.SelectedItem.Equals(filter.DisplayName))
             {
                 filterToEdit = filter;
             }
         }
         AddFilter form = new AddFilter(filterToEdit, openedFile.Name);
         if (form.ShowDialog() == DialogResult.OK)
         {
             Filters.Remove(filterToEdit);
             Filters.Add(form.FilterToPass);
             filterListBox.Items.RemoveAt(index);
             filterListBox.Items.Insert(index, form.FilterToPass.DisplayName);
             filterListBox.Refresh();
         }
     }
     doRemoveBtn.Enabled = filterListBox.Items.Count > 0 && openedFile != null;
 }
예제 #2
0
        private void addBtn_Click(object sender, EventArgs e)
        {
            AddFilter filterForm = new AddFilter(new Filter(), openedFile.Name);

            if (filterForm.ShowDialog() == DialogResult.OK)
            {
                Filters.Add(filterForm.FilterToPass);
                filterListBox.Items.Add(filterForm.FilterToPass.DisplayName);
            }
            filterListBox.Refresh();
            doRemoveBtn.Enabled =
                filterListBox.Items.Count > 0 && openedFile != null;
        }