예제 #1
0
        /// <summary>
        /// Checks the reference viscosity after calculation.
        /// </summary>
        /// <returns><c>true</c> if it is a float value, <c>false</c> otherwise.</returns>
        private bool CheckReferenceViscosityAfterCalculation()
        {
            bool result;

            Element referenceViscosity = new FluidPropertiesElements().EditControlReferenceViscosity;

            if (referenceViscosity == null)
            {
                Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "The element 'Reference viscosity' is null.");
                result = false;
            }
            else
            {
                string       referenceViscosityText = referenceViscosity.GetAttributeValueText("Text");
                const string Pattern = @"(\d{1,})";
                var          regex   = new Regex(Pattern);

                if (regex.IsMatch(referenceViscosityText))
                {
                    Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Reference viscosity = " + referenceViscosityText + ".");
                    result = true;
                }
                else
                {
                    Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Reference viscosity = " + referenceViscosityText + ".");
                    result = false;
                }
            }

            return(result);
        }
예제 #2
0
        /// <summary>
        /// Checks the reference temperature after calculation.
        /// </summary>
        /// <returns><c>true</c> if it represents a float value, <c>false</c> otherwise.</returns>
        private bool CheckReferenceTemperatureAfterCalculation()
        {
            bool result;

            Element referenceTemperature = new FluidPropertiesElements().NumericTextBoxReferenceTemperature;

            if (referenceTemperature == null)
            {
                Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "The element 'Reference temperature' is null.");
                result = false;
            }
            else
            {
                string       referenceTemperatureText = referenceTemperature.GetAttributeValueText("Text");
                const string Pattern = @"(\d{1,}\.\d{1,})";
                var          regex   = new Regex(Pattern);

                if (regex.IsMatch(referenceTemperatureText))
                {
                    Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Reference temperature = " + referenceTemperatureText + ".");
                    result = true;
                }
                else
                {
                    Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Reference temperature does not match the pattern digit(s).digit(s). Temperature = " + referenceTemperatureText + ".");
                    result = false;
                }
            }

            return(result);
        }