async Task GetDetailedHumidity(DateTime date, CancellationToken ct) { try { ct.ThrowIfCancellationRequested(); IsLoading = true; var model = await _dal.GetDateHistory(_location, TIMEZONE, date); ct.ThrowIfCancellationRequested(); if (model != null) { var results = model.OrderBy(m => m.Date).Select(m => HumidityViewModel.MapFromModel(m)).ToList(); ct.ThrowIfCancellationRequested(); DetailedHumidityCollection.Clear(); foreach (var result in results) { DetailedHumidityCollection.Add(result); } } } catch (OperationCanceledException) { } finally { IsLoading = false; } }
async Task GetLatestHumidity() { CanGetLatestHumidity(false); var model = await _dal.GetLatestReadingAsync(_location, TIMEZONE); if (model != null) { LatestHumidity = HumidityViewModel.MapFromModel(model); } CanGetLatestHumidity(true); }