示例#1
0
        public void ajouterAffectation(Affectation affectationAAjouter)
        {
            try
            {
                testValiditeExpression(affectationAAjouter.obtenirValeurAAffecter(), typeof(double).Name);
            }
            catch (Exception e)
            {
                return;
            }

            this.algorithme.ajouterInstruction(affectationAAjouter, this.listBox2.SelectedIndex);
            this.remplirListBoxAlgorithme();
        }
示例#2
0
        private void traiteAffectation(Affectation affectationCourante)
        {

            String expressionAEvaluer = affectationCourante.obtenirValeurAAffecter();
            this.remplaceValeurDesVariables(ref expressionAEvaluer);

            try
            {
                double resultatExpression = Convert.ToDouble(new Expression(expressionAEvaluer).Evaluate());
                this.rechercheLaVariableDeNom(affectationCourante.obtenirNomVariable()).changerValeur(resultatExpression);
            }
            catch (Exception e)
            {
                this.expressionAEvaluerInvalide();
            }

        }