void RemovePatternBtnClick(object sender, EventArgs e) { object selectedItem = patternListBox.SelectedItem; if (selectedItem != null) { string patternName = selectedItem.ToString(); DialogResult dialogResult = MessageBox.Show("Are you sure you want to remove the selected pattern?", "Remove Pattern", MessageBoxButtons.YesNoCancel); switch (dialogResult) { case DialogResult.Yes: PatternDictionary.GetInstance().RemovePattern(patternName); patternListBox.Items.Remove(patternName); patternInputLabelTable.Clear(); break; default: return; } } else { MessageBox.Show("Please select pattern to remove first.", "Remove Pattern"); } }
void ClearBtnClick(object sender, EventArgs e) { patternInput.Clear(); }