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(); }
public ItemFilterEditor(Filter inFilter) { InitializeComponent(); if (inFilter.Type != FilterType.Item) throw new Exception("Tried to edit a filter of type " + inFilter.Type + " in the item editor!"); this.filter = (ItemFilter)inFilter; txtName.Text = filter.Name; txtMinLVL.Text = filter.MinLVL.ToString(); if (string.IsNullOrWhiteSpace(filter.soundName) == false) txtSound.Text = filter.soundName; else txtSound.Text = "sound.wav"; boxQuality.Items.AddRange(Enum.GetNames(typeof(ItemQuality))); boxQuality.SelectedItem = Enum.GetName(typeof(ItemQuality), filter.Quality); UpdateListBoxes(); }