Exemple #1
0
        static void Main(string[] args)
        {
            //var apiKey = "68247420ccab2971c4ef714b3cdefe68";
            //var oneCallApi = new OpenWeatherMapClient.OneCallRequest(apiKey);
            //for (int i = 0; i < 100; i++)
            //{
            //    var weather = oneCallApi.GetCurrentAndForecastWeather(new Coordinates(new Random().Next(10, 90), new Random().Next(-90, 90)));
            //    Console.WriteLine("{4} | {0} [{1} {2}]: {3}", weather.Timezone, weather.Longitude, weather.Latitude, weather.CurrentWeather.Temp.Celsius, i);
            //}

            var apiKey     = "68247420ccab2971c4ef714b3cdefe68";
            var oneCallApi = new OpenWeatherMapClient.OneCallRequest(apiKey);

            var sino = Task.Run <Coordinates>(async() => await GetCoordinatesAsync("Сино, Душанбе, Тоҷикистон")).Result;

            var weather = oneCallApi.GetCurrentAndForecastWeather(sino);

            Console.WriteLine("{0} [{1} {2}]: {3}", weather.Timezone, weather.Longitude, weather.Latitude, weather.CurrentWeather.Temp.Celsius);

            var shohmansur = Task.Run <Coordinates>(async() => await GetCoordinatesAsync("Вахдат, Тоҷикистон")).Result;

            weather = oneCallApi.GetCurrentAndForecastWeather(shohmansur);
            Console.WriteLine("{0} [{1} {2}]: {3}", weather.Timezone, weather.Longitude, weather.Latitude, weather.CurrentWeather.Temp.Celsius);


            Console.ReadLine();
        }
        public IActionResult Today()
        {
            var apiKey     = "68247420ccab2971c4ef714b3cdefe68";
            var oneCallApi = new OpenWeatherMapClient.OneCallRequest(apiKey);

            oneCallApi.GetCurrentAndForecastWeatherRawJson(new Coordinates(1, 2));

            return(View());
        }