public static async Task<WeatherDescription> TryToGetWeatherAsync(GeoTagsEntry geoTags) {
CleanUpCache();
CachedEntry cached;
if (LocalCache.TryGetValue(geoTags, out cached)) {
return cached.Item2;
}
try {
var result = await new OpenWeatherApiProvider().GetWeatherAsync(geoTags);
LocalCache.Add(geoTags, new CachedEntry(DateTime.Now, result));
return result;
} catch (WebException e) {
Logging.Warning("TryToGetWeather(): " + e.Message);
return null;
} catch (Exception e) {
Logging.Warning("TryToGetWeather(): " + e);
return null;
}
}
}