コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: CasesViewModel.cs プロジェクト: shawyunz/Covid19nz
        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();
        }
コード例 #3
0
 public ViewWidgetPage(CovidLocation ountryWidget)
 {
     InitializeComponent();
     BindingContext = _viewModel = new ViewWidgetViewModel(ountryWidget);
 }