Exemplo n.º 1
0
        private async Task <IEnumerable <CityWeather> > LoadCityWeather(City city, int number)
        {
            IParser <CityWeather> weatherParser         = new GismeteoWeatherPageParser(city);
            IParserSettings       weatherParserSettings = new GismeteoSettings();

            weatherParserSettings.targetUrlPart = city.url;
            ParserWorker <CityWeather> pageWorker = new ParserWorker <CityWeather>(weatherParserSettings, weatherParser);
            IEnumerable <CityWeather>  temp       = await pageWorker.DoWork();

            lock (locker)
            {
                citiesWeather.AddRange(temp);
            }
            //ConsoleLogger.Log("CITY DONE "+number);
            return(temp);
        }
Exemplo n.º 2
0
        private async void UpdateCities()
        {
            ConsoleLogger.Log("Updating weather...");

            IParser <City>      mainPageParser         = new GismeteoMainPageParser();
            IParserSettings     mainPageParserSettings = new GismeteoSettings();
            ParserWorker <City> mainPageWorker         = new ParserWorker <City>(mainPageParserSettings, mainPageParser);

            ConsoleLogger.Log("Load cities...");

            IEnumerable <City> lst = await mainPageWorker.DoWork();

            CityRepository cityRepository = new CityRepository();

            ConsoleLogger.Log("Check cities...");
            cityRepository.AddItems(lst);
        }