public async Task <IHttpActionResult> RetrieveWeatherINFOAsync(string citiesFile)
        {
            //Read input file
            Dictionary <long, string> dctCities = FileHelper.RetrieveCities(citiesFile);

            //Call OpenWeather API
            foreach (var city in dctCities)
            {
                string result = await OpenWeatherAPIHelper.GetCityInfo(city.Key);

                //Store the results in Output folder
                FileHelper.SaveAPIResponse(city.Key, result);
            }

            return(Ok());
        }
Beispiel #2
0
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            var activity = await result as Activity;

            //var city = activity.Text ?? string.Empty;

            var query          = activity.Text ?? string.Empty;
            var luisInformaion = await LuisHelper.ParseTextAsync(query);

            var city = GetCityName(luisInformaion);


            var weatherInforamion = await OpenWeatherAPIHelper.GetWeatherDataAsync(city);

            var weatherstring = GetWeather(weatherInforamion);
            await context.PostAsync(weatherstring);

            context.Wait(MessageReceivedAsync);
        }