コード例 #1
0
        /// <summary>
        /// Copy constructor
        /// Coping from other BoltwoodFields obj
        /// </summary>
        /// <param name="objCopied"></param>
        public BoltwoodFields(BoltwoodFields objCopied)
        {
            Bolt_date = objCopied.Bolt_date;
            Bolt_time = objCopied.Bolt_time;

            TempUnits      = objCopied.TempUnits;
            WindSpeedUnits = objCopied.WindSpeedUnits;

            Bolt_SkyTemp    = objCopied.Bolt_SkyTemp;
            Bolt_Temp       = objCopied.Bolt_Temp;
            Bolt_SensorTemp = objCopied.Bolt_SensorTemp;
            Bolt_WindSpeed  = objCopied.Bolt_WindSpeed;
            Bolt_Hum        = objCopied.Bolt_Hum;
            Bolt_Heater     = objCopied.Bolt_Heater;

            Bolt_RainFlag = objCopied.Bolt_RainFlag;
            Bolt_WetFlag  = objCopied.Bolt_WetFlag;

            Bolt_SinceLastMeasure = objCopied.Bolt_SinceLastMeasure;
            Bolt_now = objCopied.Bolt_now;

            Bolt_CloudCond   = objCopied.Bolt_CloudCond;
            Bolt_WindCond    = objCopied.Bolt_WindCond;
            Bolt_RainCond    = objCopied.Bolt_RainCond;
            Bolt_DaylighCond = objCopied.Bolt_DaylighCond;

            Bolt_RoofCloseFlag = objCopied.Bolt_RoofCloseFlag;
            Bolt_AlertFlag     = objCopied.Bolt_AlertFlag;
        }
コード例 #2
0
        /// <summary>
        /// Copy from another BoltwoodClass object
        /// </summary>
        /// <param name="objCopied"></param>
        public void CopyEssentialParameters(BoltwoodFields objCopied)
        {
            if (objCopied == null)
            {
                return;
            }

            TempUnits      = objCopied.TempUnits;
            WindSpeedUnits = objCopied.WindSpeedUnits;

            Bolt_SkyTemp    = objCopied.Bolt_SkyTemp;
            Bolt_Temp       = objCopied.Bolt_Temp;
            Bolt_SensorTemp = objCopied.Bolt_SensorTemp;
            Bolt_WindSpeed  = objCopied.Bolt_WindSpeed;
            Bolt_Hum        = objCopied.Bolt_Hum;
            Bolt_Heater     = objCopied.Bolt_Heater;

            Bolt_RainFlag = objCopied.Bolt_RainFlag;
            Bolt_WetFlag  = objCopied.Bolt_WetFlag;

            Bolt_CloudCond   = objCopied.Bolt_CloudCond;
            Bolt_WindCond    = objCopied.Bolt_WindCond;
            Bolt_RainCond    = objCopied.Bolt_RainCond;
            Bolt_DaylighCond = objCopied.Bolt_DaylighCond;

            Bolt_RoofCloseFlag = objCopied.Bolt_RoofCloseFlag;
            Bolt_AlertFlag     = objCopied.Bolt_AlertFlag;
        }
コード例 #3
0
        //Return Bolwood Object
        public BoltwoodFields getBoltwoodObject()
        {
            BoltwoodFields BoltwoodSate = new BoltwoodFields();

            BoltwoodSate.Bolt_date = Date;
            BoltwoodSate.Bolt_time = Time;

            BoltwoodSate.Bolt_SkyTemp    = SkyTemp;
            BoltwoodSate.Bolt_Temp       = AmbientTemp;
            BoltwoodSate.Bolt_SensorTemp = SensorTemp;
            BoltwoodSate.Bolt_WindSpeed  = WindSpeed;
            BoltwoodSate.Bolt_Hum        = Humidity;

            BoltwoodSate.Bolt_DewPoint = DewPoint;
            BoltwoodSate.Bolt_Heater   = Heater;

            BoltwoodSate.Bolt_RainFlag = RainFlag;
            BoltwoodSate.Bolt_WetFlag  = WetFlag;

            BoltwoodSate.Bolt_SinceLastMeasure = (ushort)SecondsSince;
            BoltwoodSate.Bolt_now = Now;

            BoltwoodSate.Bolt_CloudCond   = CloudCond;
            BoltwoodSate.Bolt_WindCond    = WindCond;
            BoltwoodSate.Bolt_RainCond    = RainCond;
            BoltwoodSate.Bolt_DaylighCond = DaylightCond;

            BoltwoodSate.Bolt_RoofCloseFlag = Bolt_RoofCloseFlag;
            BoltwoodSate.Bolt_AlertFlag     = Bolt_AlertFlag;

            return(BoltwoodSate);
        }
コード例 #4
0
        public string SerializeToJSON()
        {
            //make copy of current obj in BoltwoodFields format (to not include misc fileds)
            BoltwoodFields obj = new BoltwoodFields(this);
            //serialize
            string st = new JavaScriptSerializer().Serialize(obj);

            return(st);
        }
コード例 #5
0
        public void DeserializeFromJSON(string st)
        {
            //Just for try
            var json  = new JavaScriptSerializer().DeserializeObject(st);
            var json2 = new JavaScriptSerializer().Deserialize <Dictionary <string, dynamic> >(st);

            //Convert to BoltwoodField object
            BoltwoodFields tempBoltwoodState = (BoltwoodFields) new JavaScriptSerializer().Deserialize(st, typeof(BoltwoodFields));

            CopyEssentialParameters(tempBoltwoodState);
        }
コード例 #6
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ObservatoryControls_boltwood()
        {
            //BoltwoodFileClass.BoltwoodFilePath = ConfigManagement.ProgDocumentsPath;

            BoltwoodObj           = new BoltwoodClass();
            BoltwoodObj_GoodState = new BoltwoodFields();
            BoltwoodObj_BadState  = new BoltwoodFields();

            //set settings
            BoltwoodObj.ForcedDecimalSeparator = decimalSeparatorType.useComma;
            BoltwoodObj.DONT_USE_DIRECT_ACCESS = false;

            //load default presets
            Load_Presets();

            Switch_to_GOOD();
        }