Beispiel #1
0
        public static async Task <TimeZoneInfo> TryToDetermineAsync(GeoTagsEntry geoTags)
        {
            var key = Key + geoTags;

            if (CacheStorage.Contains(key))
            {
                return(CacheStorage.GetTimeZoneInfo(key));
            }

            try {
                var result = await GoogleApiProvider.DetermineTimeZoneAsync(geoTags);

                CacheStorage.Set(key, result);
                return(result);
            } catch (WebException e) {
                Logging.Warning("TryToDetermineAsync(): " + e.Message);
                return(null);
            } catch (Exception e) {
                Logging.Warning("TryToDetermineAsync(): " + e);
                CacheStorage.Set(key, "");
                return(null);
            }
        }