private void RemoveTrigger() { var trigger = (Trigger)ObservableTriggers.CurrentItem; if (trigger == null) { DialogResult msgBox = MessageBox.Show("No trigger is selected"); return; } DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete " + trigger.Name + " ?", "Confirm dialog", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { _triggerEngine.RemoveTrigger(trigger); ObservableTriggers.Refresh(); } else if (dialogResult == DialogResult.No) { } }