예제 #1
0
        private static latLong LookUpPoints(latLong LatLong, out string station)
        {
            string Lookup = String.Join(",", "GovWeather3Points", LatLong.Latitude.ToString(), LatLong.Longitude.ToString());
            string Item   = SharedObjects.AppSettings.ReadSetting(Lookup);

            if (string.IsNullOrWhiteSpace(Item))
            {
                JObject item        = JObject.Parse(SharedObjects.CompressedCallSite($"https://api.weather.gov/points/{LatLong.Latitude},{LatLong.Longitude}", Gov_User));
                var     jProperties = item["properties"];

                station = jProperties.Value <string>("cwa");
                latLong response = new latLong(jProperties.Value <float>("gridX"), jProperties.Value <float>("gridY"));
                SharedObjects.AppSettings.AddUpdateAppSettings(Lookup, String.Join(",", response.Latitude.ToString(), response.Longitude.ToString(), station));
                return(response);
            }
            else
            {
                string[] SS = Item.Split(',');
                station = SS[2];
                return(new latLong(float.Parse(SS[0]), float.Parse(SS[1])));
            }
        }
예제 #2
0
 void ISharedInterface.Load()
 {
     LatLong = GetLocationProperty();
     Grid    = LookUpPoints(LatLong, out StationID);
 }