public ResultatCalcul Vérifie(out string resultat)
        {
            resultat = "";

            int s1 = textBoxZ1.Integer2;
            int s2 = textBoxZ2.Integer2;

            if (s1 == int.MinValue || s2 == int.MinValue)
            {
                FormErreur.Show("TU DOIS ENTRER DES NOMBRES !");
                return(ResultatCalcul.ErreurSaisie);
            }

            if (s1 != prix[0] || s2 != prix[1])
            {
                FormErreur.Show("Erreur, ce n'est pas ça !");

                resultat = "erreur";
                textBoxZ1.Select();
                return(ResultatCalcul.Erreur);
            }

            resultat = string.Format("problème {0} résolu", checkBoxDifficile.Checked ? "difficile" : "facile");

            buttonCheck.Enabled = false;
            return(ResultatCalcul.OK);
        }
示例#2
0
        public ResultatCalcul Vérifie(out string resultat)
        {
            int z;

            if (!int.TryParse(textBoxZ.Text, out z))
            {
                // peu probable avec la NumericBox

                FormErreur.Show("TU DOIS ENTRER UN NOMBRE !");
                //MessageBox.Show("TU DOIS ENTRER UN NOMBRE !", "Calculs CE1", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                textBoxZ.Focus();
                resultat = "";
                return(ResultatCalcul.ErreurSaisie);
            }

            bool ok = algo.vérifie(z, out resultat);

            if (!ok)
            {
                FormErreur.Show(resultat);
                textBoxZ.Focus();
            }
            else
            {
                buttonCheck.Enabled = false;
            }

            return(ok ? ResultatCalcul.OK : ResultatCalcul.Erreur);
        }
示例#3
0
        static public void Show(string operation)
        {
            FormErreur frm = new FormErreur();

            frm.label1.Text = operation;

            frm.timer1.Interval = 3000;
            frm.timer1.Start();

            frm.ShowDialog();
        }
示例#4
0
        public ResultatCalcul Vérifie(out string resultat)
        {
            resultat = "";
            int saisie = textBoxZ.Integer;

            if (saisie != inconnue)
            {
                FormErreur.Show("Erreur, ce n'est pas ça !");

                resultat = "erreur";
                textBoxZ.Select();
                return(ResultatCalcul.Erreur);
            }

            resultat = string.Format("chiffres romains: {0}", inconnue);

            buttonCheck.Enabled = false;
            return(ResultatCalcul.OK);
        }
示例#5
0
        public ResultatCalcul Vérifie(out string resultat)
        {
            resultat = "";

            if (Lettres)
            {
                if (!compare(false))
                {
                    FormErreur.Show("Erreur, ce n'est pas " + inconnue.ToString());

                    resultat = "erreur " + textBoxL.Text;
                    textBoxL.Select();
                    return(ResultatCalcul.Erreur);
                }

                resultat      = textBoxL.Text;
                textBoxL.Text = Littéral.Int2Lettres(inconnue);
            }
            else
            {
                int saisie = textBoxZ.Integer2;

                if (saisie == int.MinValue)
                {
                    FormErreur.Show("TU DOIS ENTRER UN NOMBRE !");
                    return(ResultatCalcul.ErreurSaisie);
                }

                if (saisie != inconnue)
                {
                    FormErreur.Show("Erreur, ce n'est pas ça !");

                    resultat = "erreur " + textBoxL.Text;
                    textBoxZ.Select();
                    return(ResultatCalcul.Erreur);
                }

                resultat = inconnue.ToString();
            }

            buttonCheck.Enabled = false;
            return(ResultatCalcul.OK);
        }
        public void verifie()
        {
            timerProgressBar.Stop();

            string         resultat;
            ResultatCalcul r;

            try
            {
                r = userControlCalcul.Vérifie(out resultat);
            }
            catch
            {
                FormErreur.Show("SAISIE INVALIDE - RECOMMENCE");
                return;
            }

            if (r == ResultatCalcul.ErreurSaisie)
            {
                timerProgressBar.Start();
                return;
            }

            if (toolStripProgressBar1.Value < toolStripProgressBar1.Maximum)
            {
                if (r != ResultatCalcul.OK)
                {
                    etoilesConsécutives = 0;
                    resultat           += " *";
                }
                else
                {
                    ++etoilesConsécutives;
                    resultat += " " + new string('*', etoilesConsécutives);
                }
            }
            else
            {
                etoilesConsécutives = 0;
            }

            Historique.Add(resultat);

            if (r != ResultatCalcul.OK)
            {
                toolStripStatusLabelErreurs.Text = string.Format("Erreurs: {0}", ++erreurs);

                timerProgressBar.Start();
                return;
            }

            toolStripStatusLabelSucces.Text = string.Format("Succès: {0}", ++succes);

            labelBravo.Visible      = true;
            pictureBoxPhoto.Visible = true;
            if (toolStripProgressBar1.Value < toolStripProgressBar1.Maximum)
            {
                pictureBoxStar.Visible = true;
            }
            toolStripProgressBar1.Value = 0;

            if (etoilesConsécutives >= 5)
            {
                new FormBravo(comboBoxPrenom.Text).ShowDialog(this);
                etoilesConsécutives = 0;
            }

            timerEncore.Interval = 3000;         // nouveau calcul dans 3 secondes
            timerEncore.Start();
        }