private void UpdatePollenForecast()
 {
     Dispatcher.InvokeAsync(new Action(async() =>
     {
         try
         {
             if (_ApplicationOptions.SelectedZip != null && DateTime.Now > _PollenForecastExpires)
             {
                 var pollenForecast = await _PollenClient.GetPollenDataForZip(_ApplicationOptions.SelectedZip.Zip);
                 if (pollenForecast?.Location?.Periods == null || !pollenForecast.Location.Periods.Any())
                 {
                     return;
                 }
                 PollenIndex.Content    = "Pollen Index: " + pollenForecast.Location.Periods.First().Index;
                 _PollenForecast        = pollenForecast;
                 _PollenForecastExpires = DateTime.Now + _PollenForecastLifetime;
             }
         }
         catch (Exception ex)
         {
             ErrorHelper.EmitError(ex);
         }
     }));
 }
Beispiel #2
0
 public async Task Test()
 {
     var sut = new PollenClient();
     var x   = await sut.GetPollenDataForZip(12345);
 }