Example #1
0
 public void Update(CovidCountryReport Report)
 {
     this.Report         = Report;
     txtCountryName.Text = Report.RegionalFriendlyName ?? Report.Country;
     ResolveFavouriteStar();
     txtCases.Text = $"{Report.Cases.ToKMB()}";
 }
        public async Task RegisterCountryAsync(CovidCountryReport country)
        {
            _countryList.TryGetValue(country.Slug, out var entry);

            if (entry == null)
            {
                entry = new CovidCountryReport
                {
                    CountryCode    = country.CountryCode,
                    CountryCountry = country.CountryCountry,
                    Slug           = country.Slug,
                };
            }

            if (entry != null)
            {
                entry.Date           = country.Date;
                entry.NewConfirmed   = country.NewConfirmed;
                entry.TotalConfirmed = country.TotalConfirmed;
                entry.NewDeaths      = country.NewDeaths;
                entry.TotalDeaths    = country.TotalDeaths;
                entry.NewRecovered   = country.NewRecovered;
                entry.TotalRecovered = country.TotalRecovered;
                _countryList.TryAdd(country.Slug, entry);
            }
            await Task.CompletedTask;
        }
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            CovidCountryReport Report = data.GetStringExtra("Report").FromJson <CovidCountryReport>();

            CountriesAdapter_ItemClick(this, Report);
            base.OnActivityResult(requestCode, resultCode, data);
        }
 private void CountriesAdapter_ItemClick(object sender, CovidCountryReport Report)
 {
     DebugHelper.Method(MethodBase.GetCurrentMethod());
     this.DetailsFragment.Update(Report);
     HideByCountries();
     HideMainTitle();
     ShowDetails();
 }
Example #5
0
        public async override Task <HandshakeResponse> RegisterCountryReport(
            CovidCountryReport request, ServerCallContext context)
        {
            await _repository.RegisterCountryAsync(request);

            return(new HandshakeResponse
            {
                ClientToken = DateTime.Now.ToLongTimeString(),
                ServerToken = DateTime.Now.ToLongTimeString()
            });
        }
 public void Update(CovidCountryReport Report)
 {
     this.Report = Report;
     this.txtCountryName.Text    = Report.RegionalFriendlyName ?? Report.Country;
     this.txtCountryCount.Text   = Report.Cases.ToKMB();
     this.txtTodayCases.Text     = Report.TodayCases.ToString().TryToLongKMB();
     this.txtCriticalCases.Text  = Report.Critical.ToString().TryToLongKMB();
     this.txtActiveCases.Text    = Report.Active.ToString().TryToLongKMB();
     this.txtRecoveredCases.Text = Report.Recovered.ToKMB();
     this.txtDeathCases.Text     = Report.Deaths.ToKMB();
     this.txtTodayDeaths.Text    = Report.TodayDeaths.ToString().TryToLongKMB();
     this.txtDeathRate.Text      = Report.DeathRate?.ToString() ?? "N/A";
     ResolveFlagDrawable(Report.CountryCode);
     //ShowChartsTooltip();
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            if (SharedPreferencesHandler.ShouldUseDarkTheme(this))
            {
                SetTheme(Resource.Style.AppTheme_Dark);
            }
            SetContentView(Resource.Layout.charts_view);
            this.Report     = Intent.GetStringExtra(nameof(Report)).FromJson <CovidCountryReport>();
            ChartTypesArray = Resources.GetStringArray(Resource.Array.chart_types);

            spinnerChartType               = FindViewById <Spinner>(Resource.Id.spinnerChartType);
            spinnerChartType.Adapter       = new ArrayAdapter <string>(this, Resource.Layout.list_item, ChartTypesArray);
            spinnerChartType.ItemSelected += SpinnerChartType_ItemSelected;


            howManyDaysSpinner               = FindViewById <Spinner>(Resource.Id.spinnerDaysSpan);
            howManyDaysSpinner.Adapter       = new ArrayAdapter <int>(this, Resource.Layout.list_item, new [] { 5, 10, 20, 30, 60 });
            howManyDaysSpinner.ItemSelected += HowManyDaysSpinner_ItemSelected;

            txtProgressionTitle      = FindViewById <TextView>(Resource.Id.txtProgressionTitle);
            txtProgressionTitle.Text = $"{Resources.GetString(Resource.String.progressions)} {Report.RegionalFriendlyName ?? Report.Country}";
        }
 public static void LoadTimeseries(this CovidCountryReport TheCountry)
 {
     Const.TimeseriesContainer.Timeseries.TryGetValueMultiKey(out List <CountryTimeseriesDay> Timeseries, TheCountry.Country, TheCountry.RegionalFriendlyName, TheCountry.CountryCode);
     TheCountry.Timeseries = Timeseries;
 }