Esempio n. 1
0
        /// <summary>
        /// Loads all the countries available to pull data for
        /// </summary>
        /// <returns></returns>
        private async Task LoadAllCountries()
        {
            //pulls all of the countries in an array structure
            CountryObj[] arrayOfCountries = await DataPuller.PullAllCountries();

            //loops through each country in the array
            foreach (CountryObj c in arrayOfCountries)
            {
                //adds the country to the list of all countries
                allCountries.Add(c);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Form load event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Covid19Graphs_Load(object sender, EventArgs e)
        {
            //sets up the api helper class
            DataPuller.InitializeClient();

            //sets up the lists
            allData      = new List <Data>();
            allCountries = new List <CountryObj>();

            //makes the vertical scroll bar always visible
            countryTitle_pnl.VerticalScroll.Enabled = true;
            countryTitle_pnl.VerticalScroll.Visible = true;
            countryTitle_pnl.AutoScroll             = true;

            //pulls all countrees
            await LoadAllCountries();

            //loads up the default data
            await LoadDefaultData();
        }
Esempio n. 3
0
        /// <summary>
        /// Pulls data about the entered country
        /// </summary>
        /// <param name="slug">The slug (country-identifier) for the wanted country</param>
        /// <param name="_countryName">The name of the country</param>
        /// <param name="graphColor">The color of the countries graph points</param>
        /// <param name="lastTxtLoc">The point to base the next textbox location on</param>
        /// <returns></returns>
        public async Task PullData(CountryObj countryObj, Color graphColor)
        {
            //the tobe location of the new
            Point location = new Point(0, 0);

            //checks if this is not the first label
            if (countryTitle_pnl.Controls.Count != 0)
            {
                //adds the label under the last label
                location.Y = countryTitle_pnl.Controls[countryTitle_pnl.Controls.Count - 1].Location.Y + countryTitle_pnl.Controls[countryTitle_pnl.Controls.Count - 1].Height + 30;
            }

            CasesObj[] pulledCases;
            Label      t = new Label();

            //pulls the entered country data
            pulledCases = await DataPuller.PullConfirmedData(countryObj.Slug);

            //checks to see if the pulled country data had any data
            if (pulledCases.Length > 0)
            {
                //adds the newly pulled data into the list of all datas
                allData.Add(new Data(countryObj, pulledCases, graphColor));

                //creates and sets up a new text box with the country name and color
                t.Location    = location;
                t.Text        = countryObj.Country;
                t.Font        = new Font(t.Font.FontFamily, 12);
                t.ForeColor   = graphColor;
                t.Anchor      = AnchorStyles.Top | AnchorStyles.Right;
                t.AutoSize    = true;
                t.MaximumSize = new Size(normalise_btn.Width, 0);
                countryTitle_pnl.Controls.Add(t);

                //draws the graph
                graph.Invalidate();
            }
        }