private void addTrigger_Click(object sender, EventArgs e) { TriggerForm triggerForm = new TriggerForm(); triggerForm.ShowDialog(); GetTriggerResult(triggerForm); }
private void triggersValue_SelectedIndexChanged(object sender, EventArgs e) { if (triggersValue.SelectedIndex != -1) { TriggerForm triggerForm = new TriggerForm(_itemTriggers[triggersValue.SelectedIndex].AsBsonDocument); triggerForm.ShowDialog(); GetTriggerResult(triggerForm); } }
private void GetTriggerResult(TriggerForm triggerForm) { if (triggerForm.DialogResult == System.Windows.Forms.DialogResult.OK) { _itemTriggers.Add(triggerForm.Trigger); triggersValue.Items.Add(triggerForm.Trigger["Trigger"].AsString); } else if (triggerForm.DialogResult == System.Windows.Forms.DialogResult.Abort) { if (triggersValue.SelectedIndex != -1) { _itemTriggers.RemoveAt(triggersValue.SelectedIndex); triggersValue.Items.RemoveAt(triggersValue.SelectedIndex); } } else { //do nothing } triggerForm.Close(); }