Beispiel #1
0
        //유효한 도시인지 Check
        public static bool TestAPI(string location)
        {
            var tmp = CurrentWeatherAPI.GetWeatherInformation(location);

            if (tmp.Name != null)
            {
                return(true);
            }
            return(false);
        }
Beispiel #2
0
        public void GetWeather()
        {
            StreamReader reader   = new StreamReader("text/location.txt");
            string       location = reader.ReadLine();

            reader.Close();

            var weather = CurrentWeatherAPI.GetWeatherInformation(location);

            Weather.Name      = weather.Name;
            Weather.Main      = weather.Main;
            Weather.Wind      = weather.Wind;
            Weather.Weather   = weather.Weather;
            Weather.Feeling   = (int)(13.12 + 0.6215 * Weather.Main.Temp - 11.37 * Math.Pow(Weather.Wind.Speed * 3.6, 0.16) + 0.3965 * Math.Pow(Weather.Wind.Speed * 3.6, 0.16) * Weather.Main.Temp);
            Weather.Condition = weather.Weather[0].Main;
        }