public static IEnumerable <string> QueryFireAlerts(string alertType, string countryCode)
        {
            var nwsUrl           = ConfigurationManager.AppSettings["fireAlerts_us"].ToString();
            var fireAlertsStream = RESTTools.Get(nwsUrl);

            if (string.IsNullOrEmpty(fireAlertsStream))
            {
                yield break;
            }

            JObject jObj   = JObject.Parse(fireAlertsStream);
            var     alerts = jObj.SelectTokens("$.features[?(@.properties.event == 'Red Flag Warning')].properties.geocode.UGC");

            //var alerts = jObj.SelectTokens("$.features[?(@.properties.event == 'Fire Weather Watch')].properties.geocode.UGC");

            foreach (var alert in alerts)
            {
                foreach (var zone in alert)
                {
                    yield return((string)zone);
                }
            }

            yield break;
        }
Esempio n. 2
0
 private void worker_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         var partition = ConfigurationManager.AppSettings["subscribePartition"].ToString();
         var endpoint  = ConfigurationManager.AppSettings["listGroupAlertMembers"].ToString();
         var query     = RESTTools.Get(string.Format(endpoint, partition));
         AllMembers = JsonConvert.DeserializeObject <AlertGroups>(query);
     }
     catch { }
 }
        public CurrentWeatherConditionData QueryConditions(double lat, double lon)
        {
            var weatherapi     = ConfigurationManager.AppSettings["weatherProviderUrl"].ToString();
            var currentWeather = RESTTools.Get(string.Format(weatherapi, lat, lon));

            if (string.IsNullOrEmpty(currentWeather))
            {
                return(new CurrentWeatherConditionData());
            }

            var weatherData = JsonConvert.DeserializeObject <CurrentWeatherConditionData>(currentWeather);

            return(weatherData);
        }