AcManager.Tools.Helpers.WeatherProvider.TryToGetWeatherAsync C# (CSharp) Method

TryToGetWeatherAsync() private method

private TryToGetWeatherAsync ( GeoTagsEntry geoTags ) : Task
geoTags AcTools.Utils.Helpers.GeoTagsEntry
return Task
        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;
            }
        }
    }