private void bAccept_Click(object sender, EventArgs e) { string[] premises = tbPremises.Text.Split('\n'); string conclusion = tbConclusions.Text; List <Sentence> sentences = new List <Sentence>(); foreach (string p in premises) { Sentence s = Sentence.parseFromString(p); if (s != null && s.type != SentenceType.OTHER) { sentences.Add(s); } } Sentence se = Sentence.parseFromString(conclusion); if (se != null && se.type != SentenceType.OTHER) { sentences.Add(se.negation()); } if (sentences.Count > 0) { result = new Logic.TreeNode(sentences); } Visible = false; DialogResult = System.Windows.Forms.DialogResult.OK; }
private void button2_Click(object sender, EventArgs e) { if (tree == null) { return; } Logic.TreeNode selection = tree.getSelection(); if (selection == null) { return; } bool overwrite = (selection.left != null); DecompositionInputDialog did = new DecompositionInputDialog(); if (did.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Decomposition decomp = did.getResult(); if (decomp == null) { return; } if (overwrite) { selection.left = null; selection.right = null; tree.reset(); if (cbAuto.Checked) { checkTree(); } } if (!selection.isValidDecomposition(decomp)) { MessageBox.Show("That is not a valid decomposition", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } selection.setDecomposition(decomp); tree.deslect(); if (cbAuto.Checked) { checkTree(); } resizeStuff(); panel1.Refresh(); button2.Enabled = false; } }
private void button1_Click(object sender, EventArgs e) { BaseInputDialog bid = new BaseInputDialog(); if (bid.ShowDialog() == System.Windows.Forms.DialogResult.OK) { tree = bid.getResult(); if (cbAuto.Checked) { checkTree(); } resizeStuff(); panel1.Refresh(); bGrow.Enabled = true; button2.Enabled = false; } }
public BaseInputDialog() { InitializeComponent(); result = null; }