private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                RootObject covidData = await CovidStatsData.GetCovidStatsData();

                List <CountryWiseData> countryDataList = covidData.Countries;
                List <CountryWiseData> data            = countryDataList.Where(country => country.Country.ToUpper().Equals(countryName.ToUpper())).ToList();
                if (data.Count == 1)
                {
                    CountryName.Text    = data[0].Country.ToString();
                    ConfirmedCases.Text = string.Format("{0:#,0}", data[0].TotalConfirmed);
                    ProgressIndicatorConf.Visibility = Visibility.Collapsed;
                    FatalCases.Text = string.Format("{0:#,0}", data[0].TotalDeaths);
                    ProgressIndicatorFatal.Visibility = Visibility.Collapsed;
                    RecoveredCases.Text             = string.Format("{0:#,0}", data[0].TotalRecovered);
                    ProgressIndicatorRec.Visibility = Visibility.Collapsed;

                    NewConf.Text = string.Format("{0:#,0}", data[0].NewConfirmed);
                    StackPanelConf.Visibility  = Visibility.Visible;
                    NewFatal.Text              = string.Format("{0:#,0}", data[0].NewDeaths);
                    StackPanelFatal.Visibility = Visibility.Visible;
                    NewRec.Text = string.Format("{0:#,0}", data[0].NewRecovered);
                    StackPanelRec.Visibility = Visibility.Visible;
                }
            }
            catch (Exception ex)
            {
                NavigationService ns = NavigationService.GetNavigationService(this);
                ns.Navigate(new NetworkErrorPage());
                Console.WriteLine(ex);
            }
        }
Beispiel #2
0
        public async void dataFetch()
        {
            try
            {
                RootObject covidData = await CovidStatsData.GetCovidStatsData();

                covidData.Countries.ForEach(country => countriesList.Add(new CountryListData(country.Country)));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Beispiel #3
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                RootObject covidData = await CovidStatsData.GetCovidStatsData();

                ConfirmedCases.Text = string.Format("{0:#,0}", covidData.Global.TotalConfirmed);
                ProgressIndicatorConf.Visibility = Visibility.Collapsed;
                FatalCases.Text = string.Format("{0:#,0}", covidData.Global.TotalDeaths);
                ProgressIndicatorFatal.Visibility = Visibility.Collapsed;
                RecoveredCases.Text             = string.Format("{0:#,0}", covidData.Global.TotalRecovered);
                ProgressIndicatorRec.Visibility = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                NavigationService ns = NavigationService.GetNavigationService(this);
                ns.Navigate(new NetworkErrorPage());
                Console.WriteLine(ex);
            }

            /* List<CountryData> countryDataList = covidData.Countries; */
        }