private void btnAddDomain_Click(object sender, EventArgs e) { AllStructRename form = new AllStructRename(this); form.formtype = formType.addDomain; form.SetText(formType.addDomain); if (form.ShowDialog() == DialogResult.OK) { lblStatus.Text = "Добавлен новый домен"; } }
private void btnAddValue_Click(object sender, EventArgs e) { if (lbxDomains.SelectedIndex >= 0) { AllStructRename form = new AllStructRename(this); form.formtype = formType.addValue; form.SetText(formType.addValue); if (form.ShowDialog() == DialogResult.OK) { lblStatus.Text = "Добавлено новое значение"; } } }
private void btnChangeValue_Click(object sender, EventArgs e) { if (lbxValues.SelectedIndex >= 0) { AllStructRename form = new AllStructRename(this); form.old = lbxValues.SelectedItem.ToString().ToUpper(); form.formtype = formType.changeValue; form.SetText(formType.changeValue); if (form.ShowDialog() == DialogResult.OK) { lblStatus.Text = "Значение изменено"; } } }
private void btnChangeDomain_Click(object sender, EventArgs e) { if (lbxDomains.SelectedIndex >= 0) { AllStructRename form = new AllStructRename(this); form.old = tbDomainName.Text.Trim().ToUpper(); form.formtype = formType.changeDomain; form.SetText(formType.changeDomain); if (form.ShowDialog() == DialogResult.OK) { lblStatus.Text = "Название домена изменено"; } } }
private void btnChangeVariable_Click(object sender, EventArgs e) { if (lbxVariables.SelectedIndex >= 0) { bool used = false; string rname = ""; foreach (Rule r in kbase.rules) { foreach (Fact f in r.sendFact) { if (f.varName == lbxVariables.SelectedItem.ToString()) { used = true; if (rname == "") { rname = r.name; } } } foreach (Fact f in r.concFact) { if (f.varName == lbxVariables.SelectedItem.ToString()) { used = true; if (rname == "") { rname = r.name; } } } } DialogResult res = DialogResult.Yes; if (used) { res = MessageBox.Show("Переменная " + lbxVariables.SelectedItem.ToString() + " используется в правиле " + rname + ". Продолжить?", "", MessageBoxButtons.YesNo); } if (res != DialogResult.No) { AllStructRename form = new AllStructRename(this); form.formtype = formType.changeVariable; form.old = lbxVariables.SelectedItem.ToString().ToUpper(); form.SetText(formType.changeVariable); if (form.ShowDialog() == DialogResult.OK) { lblStatus.Text = "Переменная изменена"; } } } }
//addValue private void button17_Click(object sender, EventArgs e) { AllStructRename frm = new AllStructRename(form); frm.formtype = formType.addValue; frm.SetText(formType.addValue); frm.ShowDialog(); valName.Items.Clear(); int ind = form.kbase.vars.FindIndex(delegate(Variable v) { return(v.name == varName.SelectedItem.ToString()); }); foreach (string s in form.kbase.vars[ind].domain.values) { valName.Items.Add(s); } valName.SelectedIndex = valName.Items.Count - 1; }
private void btnAddVariable_Click(object sender, EventArgs e) { if (kbase.domains.Count > 0) { AllStructRename form = new AllStructRename(this); form.formtype = formType.addVariable; form.SetText(formType.addVariable); if (form.ShowDialog() == DialogResult.OK) { lblStatus.Text = "Добавлена новая переменная"; } } else { MessageBox.Show("Необходимо добавить домены"); } }
//addvariable private void button16_Click(object sender, EventArgs e) { if (form.kbase.domains.Count > 0) { AllStructRename form1 = new AllStructRename(form); form1.formtype = formType.addVariable; form1.SetText(formType.addVariable); form1.ShowDialog(); varName.Items.Clear(); foreach (Variable v in form.kbase.vars) { varName.Items.Add(v.name); } varName.SelectedIndex = varName.Items.Count - 1; } else { MessageBox.Show("Необходимо добавить домены"); } }