private void webpageDownloader_DoWork(object sender, DoWorkEventArgs e)
 {
     for (int i = 1; i <= 8; i++)
     {
         webpageDownloader.ReportProgress(i, DataExtractor.DownloadWebpages(i));
     }
     webpageDownloader.ReportProgress(-1);
 }
        private void finalizeWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            string xmlDir = Environment.CurrentDirectory + @"\otherXmlData";

            DataExtractor.ExtractWorldBank();
            DataExtractor.ExtractUNDP();

            finalizeWorker.ReportProgress(1, "All the data has been extracted successfully.");
        }
        private void xmlDownloader_DoWork(object sender, DoWorkEventArgs e)
        {
            bool state;

            DataExtractor.CoutriesCsvToXml(@"..\..\\csvFolder\countries_population.csv");
            DataExtractor.CountriesCodesCsvToXml(@"..\..\\csvFolder\countries_codes_and_coordinates.csv");
            DataExtractor.XmlConnector();
            var xmlLinks = DataExtractor.ParseWebpage(out state);

            if (!state)
            {
                MessageBox.Show("No webpages to parse.");
            }
            else
            {
                foreach (var xml in xmlLinks)
                {
                    try
                    {
                        DataExtractor.ParseXmlData(xml);
                        xmlDownloader.ReportProgress(1, xml);
                    }
                    catch (WebException ex)
                    {
                        xmlDownloader.ReportProgress(1, xml.Split('/').Last() + "does not exist");
                    }
                }
            }

            XmlDocument worldBankOrgFile = new XmlDocument();

            worldBankOrgFile.Load("http://siteresources.worldbank.org/INTSOPE/Resources/5929468-1305310586289/IATI_ORG.xml");
            worldBankOrgFile.Save(@".\otherxmlData\worldBank.xml");

            xmlDownloader.ReportProgress(2);
        }