Exemplo n.º 1
0
        bool DetectChangeAndCopyIt()
        {
            DataGridViewRowCollection rows = CoeffView.Rows;
            bool change = false;
            int  i      = 0;

            switch (CurveEquation)
            {
            case INCCAnalysisParams.CurveEquation.CUBIC:            // a b c d
                if (Coefficients.a != (double)rows[i].Tag)
                {
                    Coefficients.a = (double)rows[i].Tag; change = true;
                }
                i++;
                if (Coefficients.b != (double)rows[i].Tag)
                {
                    Coefficients.b = (double)rows[i].Tag; change = true;
                }
                i++;
                if (Coefficients.c != (double)rows[i].Tag)
                {
                    Coefficients.c = (double)rows[i].Tag; change = true;
                }
                i++;
                if (Coefficients.d != (double)rows[i].Tag)
                {
                    Coefficients.d = (double)rows[i].Tag; change = true;
                }
                i++;
                if (Coefficients.var_a != (double)rows[i].Tag)
                {
                    Coefficients.var_a = (double)rows[i].Tag; change = true;
                }
                i++;
                if (Coefficients.var_b != (double)rows[i].Tag)
                {
                    Coefficients.var_b = (double)rows[i].Tag; change = true;
                }
                i++;
                if (Coefficients.var_c != (double)rows[i].Tag)
                {
                    Coefficients.var_c = (double)rows[i].Tag; change = true;
                }
                i++;
                if (Coefficients.var_d != (double)rows[i].Tag)
                {
                    Coefficients.var_d = (double)rows[i].Tag; change = true;
                }
                i++;
                if (Coefficients.covar(Coeff.a, Coeff.b) != (double)rows[i].Tag)
                {
                    Coefficients.setcovar(Coeff.a, Coeff.b, (double)rows[i].Tag); change = true;
                }
                i++;
                if (Coefficients.covar(Coeff.a, Coeff.c) != (double)rows[i].Tag)
                {
                    Coefficients.setcovar(Coeff.a, Coeff.c, (double)rows[i].Tag); change = true;
                }
                i++;
                if (Coefficients.covar(Coeff.a, Coeff.d) != (double)rows[i].Tag)
                {
                    Coefficients.setcovar(Coeff.a, Coeff.d, (double)rows[i].Tag); change = true;
                }
                i++;
                if (Coefficients.covar(Coeff.b, Coeff.c) != (double)rows[i].Tag)
                {
                    Coefficients.setcovar(Coeff.b, Coeff.c, (double)rows[i].Tag); change = true;
                }
                i++;
                if (Coefficients.covar(Coeff.b, Coeff.d) != (double)rows[i].Tag)
                {
                    Coefficients.setcovar(Coeff.b, Coeff.d, (double)rows[i].Tag); change = true;
                }
                i++;
                if (Coefficients.covar(Coeff.c, Coeff.d) != (double)rows[i].Tag)
                {
                    Coefficients.setcovar(Coeff.c, Coeff.d, (double)rows[i].Tag); change = true;
                }
                i++;
                break;

            case INCCAnalysisParams.CurveEquation.POWER:             // a b
            case INCCAnalysisParams.CurveEquation.HOWARDS:           // a b
            case INCCAnalysisParams.CurveEquation.EXPONENTIAL:       // a b
                if (Coefficients.a != (double)rows[i].Tag)
                {
                    Coefficients.a = (double)rows[i].Tag; change = true;
                }
                i++;
                if (Coefficients.b != (double)rows[i].Tag)
                {
                    Coefficients.b = (double)rows[i].Tag; change = true;
                }
                i++;
                if (Coefficients.var_a != (double)rows[i].Tag)
                {
                    Coefficients.var_a = (double)rows[i].Tag; change = true;
                }
                i++;
                if (Coefficients.var_b != (double)rows[i].Tag)
                {
                    Coefficients.var_b = (double)rows[i].Tag; change = true;
                }
                i++;
                if (Coefficients.covar(Coeff.a, Coeff.b) != (double)rows[i].Tag)
                {
                    Coefficients.setcovar(Coeff.a, Coeff.b, (double)rows[i].Tag); change = true;
                }
                i++;
                break;
            }
            return(change);
        }