Ejemplo n.º 1
0
        public ErrorMessage Specify(ProcessVarDouble pv, double aValue)
        {
            ErrorMessage retMsg = null;

            if (pv.HasValueOf(aValue))
            {
                return(retMsg);
            }
            else
            {
                retMsg = CheckSpecifiedValueRange(pv, aValue);
                if (retMsg != null)
                {
                    return(retMsg);
                }
            }

            //remember currently being specified variable value
            double oldValue = pv.Value;

            beingSpecifiedProcVar = pv;

            pv.Value = aValue;
            pv.State = VarState.Specified;

            try {
                unitOpSystem.OnCalculationStarted(); //must tell UI calculation has started already
                HasBeenModified(true);
                unitOpSystem.OnCalculationEnded();   //must tell UI calculation has ended already
            }
            catch (Exception e) {
                pv.Value = oldValue;
                retMsg   = HandleException(e);
                //HasBeenModified(true);
            }
            OnProcessVarValueCommitted(pv);

            return(retMsg);
        }