Ejemplo n.º 1
0
        public NameFilterEditor(Filter filter)
        {
            InitializeComponent();

            if (filter.Type != FilterType.Name)
                throw new Exception("Tried to edit a filter with type " + filter.Type + " as a name");
            NFilter = (NameFilter)filter;

            if (string.IsNullOrWhiteSpace(NFilter.soundName))
                txtSound.Text = "sound.wav";
            else
                txtSound.Text = NFilter.soundName;

            txtName.Text = NFilter.Name;
            txtNameFilter.Text = NFilter.nameFilter;
        }
Ejemplo n.º 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Form form = null;
            Filter filter = null;

            SelectFilterForm select = new SelectFilterForm();
            if (select.ShowDialog(this) == DialogResult.OK)
            {
                switch (select.Selected)
                {
                    case FilterType.Item:
                        {
                            filter = new ItemFilter();
                            form = new ItemFilterEditor(filter);
                            break;
                        }
                    case FilterType.Name:
                        {
                            filter = new NameFilter();
                            form = new NameFilterEditor(filter);
                            break;
                        }
                }
            }
            else
                return;

            if (form.ShowDialog(this) == DialogResult.OK)
                Settings.filters.Add(filter);
            UpdateFilters();
        }