private void showRuleEditorToolStripMenuItem_Click(object sender, EventArgs e) { frmRuleEdit editor = new frmRuleEdit(onSaveRule, onCloseRuleEditorDialog); editor.Show(); }
private void editRuleItem(ListViewItem ruleItem) { if (ruleItem.SubItems[2].Text == true.ToString() ) { FromHandle(_openRuleWindows[ruleItem.Name]).BringToFront(); return; } rule rule = (rule)ruleItem.Tag; if (rule.isErrored && rule.getError().GetType() == typeof(fileReadError)) { if(MessageBox.Show( "Sorry " + rule.getError().Message + " do you want to edit it in a text editor instead?", "Unable to load", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Process.Start(_myOptions.rulesPath + @"\" + rule.name + ".rule"); } return; } frmRuleEdit newForm = new frmRuleEdit(onSaveRule, onCloseRuleEditorDialog); // We serialise the rule before we pass it to the rule edi form. This is to ease the transition // to a client-server style rule engine / rule editor kind of situations later on newForm.loadRule(rule.serialise()); newForm.ctlRuleEditor.getRule().onStatusUpdate += updateRuleIcon; newForm.Closed += ruleFormClosed; newForm.Show(); _openRuleWindows[ruleItem.Name] = newForm.Handle; // Mark this rule as being open in the editor ruleItem.SubItems[2].Text = true.ToString(); }