Ejemplo n.º 1
0
        /// <summary>
        /// Init Humidity property
        /// </summary>
        protected override void InitHumidity()
        {
            try
            {
                // get string block with humidity info
                string humBlock = Gismeteo.GetInfoBlock(weatherBlock, Gismeteo.Classes[GismeteoClasses.Humidity]);

                // init humidity
                int startValue = humBlock.IndexOf('>', humBlock.IndexOf(
                                                      Gismeteo.Markers[GismeteMarkers.Humidity])) + 1;
                int endValue = humBlock.IndexOf('<', startValue);

                Humidity = new Humidity
                {
                    // init value
                    Value = humBlock.Substring(startValue, endValue - startValue),

                    // init  unit
                    Units = "%",

                    // init humidity image
                    Img = "Icons/Water-26.png",

                    // init description
                    Description = "влажн."
                };
            }
            catch (Exception ex)
            {
                throw new Exception("Humidity info has not found", ex);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Init Humidity property
 /// </summary>
 protected override void InitHumidity()
 {
     try
     {
         Humidity = new Humidity
         {
             Value       = jtoken[WUnderground.Values[JsonValue.Humudity]].ToString(),
             Units       = string.Empty,
             Img         = "Icons/Water-26.png",
             Description = "humudity"
         };
     }
     catch (Exception ex)
     {
         throw new Exception("Humidity info has not found", ex);
     }
 }