private void buttonAdd_Click(object sender, EventArgs e) { FormSoundNotifyConfigDialog dialog = new FormSoundNotifyConfigDialog(ParentModule, FormSoundNotifyConfigDialogMode.Add); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string condition = dialog.textBoxChooseCond.Text; List<string> specCond = new List<string>(); if (dialog.checkBoxUseRegexSemantics.Checked) { specCond.Add("s:CustomRegex"); } else condition = ParentModule.ConvertCondOutputToRegex(condition); if (dialog.checkedListBoxSearchIn.CheckedItems.Count > 0) { foreach (string line in dialog.checkedListBoxSearchIn.CheckedItems) { specCond.Add(line); } } ParentModule.AddPlaylistEntry(dialog.listBoxChooseSound.Text, condition, specCond, true); RefreshBankAndList(); } }
private void buttonEdit_Click(object sender, EventArgs e) { if (listViewSounds.SelectedItems.Count > 0) { int oldEntryIndex = Convert.ToInt32(listViewSounds.SelectedItems[0].Text) - 1; bool oldActive = ParentModule.getPlaylistEntryAtIndex(oldEntryIndex).isActive; FormSoundNotifyConfigDialog dialog = new FormSoundNotifyConfigDialog( ParentModule, FormSoundNotifyConfigDialogMode.Edit, ParentModule.getPlaylistEntryAtIndex(oldEntryIndex)); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string condition = dialog.textBoxChooseCond.Text; ParentModule.RemovePlaylistEntry(oldEntryIndex); List<string> specCond = new List<string>(); if (dialog.checkBoxUseRegexSemantics.Checked) { specCond.Add("s:CustomRegex"); } else condition = ParentModule.ConvertCondOutputToRegex(condition); if (dialog.checkedListBoxSearchIn.CheckedItems.Count > 0) { foreach (string line in dialog.checkedListBoxSearchIn.CheckedItems) { specCond.Add(line); } } ParentModule.AddPlaylistEntry(dialog.listBoxChooseSound.Text, condition, specCond, oldActive, oldEntryIndex); RefreshBankAndList(); } } }