Example #1
0
        private void Valide1_Click(object sender, EventArgs e)
        {
            if (!((VarsS_List.Items.Count > 0) & (Xlist.Items.Count > 0)))
            {
                MessageBox.Show("Verifier vos données !", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            UserGrammer = new Grammer(new ArrayList(Xlist.Items), new ArrayList(VarsS_List.Items), (char)Axiom.SelectedItem);
            UserGrammer.X.Add(Automata.EPSILON);
            Valider2.Enabled = true;
            groupBox1.Enabled = false;
            groupBox3.Enabled = false;
            groupBox2.Enabled = true;
        }
Example #2
0
        private void Automates_tree_DoubleClick(object sender, EventArgs e)
        {
            try
            {

                Selected = getautomate(Automates_tree.SelectedNode.Text);
                //////////////////////////////
                if (Selected.Automate == null) return;
                //////////////////////////////
                Grammer UserGrammer = new Grammer();
                switch (Selected.type)
                {
                    case Automata.TYPE.Dfa:
                        ((Dfa)Selected.Automate).Afficher_grid(transition_Grid);
                        ((Dfa)Selected.Automate).Draw(Drawpanel, true);
                        UserGrammer = ((Dfa)Selected.Automate).toGrammer();
                        GrammerRTF.Text = UserGrammer.ToString();
                        break;
                    case Automata.TYPE.Nfa:

                        ((Nfa)Selected.Automate).Afficher_grid(transition_Grid);
                        ((Nfa)Selected.Automate).Draw(Drawpanel, true);
                        UserGrammer = ((Nfa)Selected.Automate).toGrammer();
                        GrammerRTF.Text = UserGrammer.ToString();
                        break;
                    case Automata.TYPE.PGfa:
                        ((PGfa)Selected.Automate).Afficher_grid(transition_Grid);
                        ((PGfa)Selected.Automate).Draw(Drawpanel, true);
                        UserGrammer = ((PGfa)Selected.Automate).toGrammer();
                        GrammerRTF.Text = UserGrammer.ToString();
                        break;
                    case Automata.TYPE.Gfa:
                        ((Gfa)Selected.Automate).Afficher_grid(transition_Grid);
                        ((Gfa)Selected.Automate).Draw(Drawpanel, true);
                        try
                        {
                            UserGrammer = ((Gfa)Selected.Automate).toGrammer();
                        }
                        catch (Exception)
                        {
                            break;
                        }

                        break;
                    default:
                        break;

                }
                UserGrammer.AfficherGrammair(GrammerRTF);

                Type_label.Text = "L'automate : " + ((Automata)Selected.Automate).Name + "  de type : " + Selected.type.ToString();
            }
            catch (Exception)
            {
                Type_label.Text = "L'automate : " + ((Automata)Selected.Automate).Name + "  de type : " + Selected.type.ToString() + "!!!";
            }
        }
Example #3
0
 private void Modifier1_Click(object sender, EventArgs e)
 {
     DialogResult resAlert;
     resAlert = MessageBox.Show("Voulez allez perdre vos instructions !", "alert !", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
     if (resAlert == DialogResult.OK)
     {
         Valider2.Enabled = false;
         groupBox1.Enabled = true;
         groupBox3.Enabled = true;
         groupBox2.Enabled = false;
         Productions.Items.Clear();
         UserGrammer = new Grammer(new ArrayList(Xlist.Items), new ArrayList(Vars_List.Items), (char)Axiom.SelectedItem);
     }
 }