public async Task <CovidLocation> ScrapeTotalCovidCases() { var _covidLocation = new CovidLocation { Confirmed = 0, Deaths = 0, Recovered = 0 }; try { var _result = await _httpClient.GetAsync($"{_host}/v1/covid/world"); if (_result.IsSuccessStatusCode) { var _content = await _result.Content.ReadAsStringAsync(); _covidLocation = JsonConvert.DeserializeObject <CovidLocation>(_content); } } catch (Exception ex) { throw ex; } return(_covidLocation); }
public CasesViewModel(CovidLocation location = null) { Title = location is null ? "All Cases" : location?.LocationName + " (" + location?.CaseCount + ")"; SelectedLocation = location; AllCases = new ObservableCollection <CovidCase>(); DisplayCases = new ObservableCollection <CovidCase>(); LoadFilterCommand = new Command(() => LoadFilterCases()); LoadItemsCommand = new Command(() => ExecuteLoadCasesCommand()); ShowHelpCommand = new Command(() => ShowHelp()); ExecuteLoadCasesCommand(); }
public ViewWidgetPage(CovidLocation ountryWidget) { InitializeComponent(); BindingContext = _viewModel = new ViewWidgetViewModel(ountryWidget); }