Exemplo n.º 1
0
 private void Props_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
 {
     if (rule != null)
     {
         grammarRuleDisplay gDisplay = (grammarRuleDisplay)graphControl.FindForm();
         rule.updateGraphControl(gDisplay.graphControlLHS, gDisplay.graphControlRHS,
                                 gDisplay.globalLabelsLText, gDisplay.globalLabelsRText);
     }
     else
     {
         graphDisplay gDisplay = (graphDisplay)graphControl.FindForm();
         graph.updateGraphControl(graphControl, gDisplay.globalLabelsText);
     }
 }
Exemplo n.º 2
0
 private void showRule_Click(object sender, EventArgs e)
 {
     try
     {
         grammarRuleDisplay ruleDisplay =
             new grammarRuleDisplay(ruleset.rules[this.checkedListBox1.SelectedIndex],
                                    this.checkedListBox1.Items[this.checkedListBox1.SelectedIndex].ToString());
         ruleDisplay.Show();
     }
     catch
     {
         MessageBox.Show("Please save RuleSet first before displaying rule.", "Rule Set not Saved",
                         MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 3
0
        public void saveCurrentItem_Click(object sender, EventArgs e)
        {
            string filename;
            string name;

            if (this.ActiveMdiChild.GetType() == typeof(graphDisplay))
            {
                graphDisplay saveDisplay = (graphDisplay)this.ActiveMdiChild;
                saveDisplay.graphDisplay_Enter(sender, e);
                name = saveDisplay.graph1.name;
                try { filename = getSaveFilename("graph", name, Program.settings.workingDirectory); }
                catch { filename = ""; }
                if (filename != "" && filename != null)
                {
                    designGraph.saveGraphToXml(filename, saveDisplay.graphControl1, saveDisplay.graph1);
                }
            }
            else if (this.ActiveMdiChild.GetType() == typeof(grammarRuleDisplay))
            {
                grammarRuleDisplay saveDisplay = (grammarRuleDisplay)this.ActiveMdiChild;
                name = saveDisplay.rule.name;
                try { filename = getSaveFilename("grammar rule", name, Program.settings.rulesDirectory); }
                catch { filename = ""; }
                if (filename != "" && filename != null)
                {
                    grammarRule.saveRuleToXml(filename, saveDisplay.rule, saveDisplay.graphControlLHS,
                                              saveDisplay.graphControlRHS, saveDisplay.globalLabelsLText, saveDisplay.globalLabelsRText);
                }
            }
            else if (this.ActiveMdiChild.GetType() == typeof(ruleSetDisplay))
            {
                ruleSetDisplay saveDisplay = (ruleSetDisplay)this.ActiveMdiChild;
                name = saveDisplay.ruleset.name;
                try { filename = getSaveFilename("rule set", name, Program.settings.rulesDirectory); }
                catch { filename = ""; }
                if (filename != "" && filename != null)
                {
                    ruleSet.saveRuleSetToXml(filename, saveDisplay.ruleset);
                }
            }
            else
            {
                MessageBox.Show("Please select an window that contains a graph, rule, or rule set.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 4
0
 private void showRule_Click(object sender, EventArgs e)
 {
     try
     {
         grammarRuleDisplay ruleDisplay =
             new grammarRuleDisplay(ruleset.rules[this.checkedListBox1.SelectedIndex],
             this.checkedListBox1.Items[this.checkedListBox1.SelectedIndex].ToString());
         ruleDisplay.Show();
     }
     catch
     {
         MessageBox.Show("Please save RuleSet first before displaying rule.", "Rule Set not Saved",
             MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }