コード例 #1
0
        static void Main(string[] args)
        {
            string      location       = "Hamburg,DE";
            WeatherData HamburgWeather = new WeatherData(location);

            HamburgWeather.CheckWeather();
            System.Console.WriteLine($"Current Weather in {location}\n" +
                                     $"Temperature {HamburgWeather.Temperature} °C\n" +
                                     $"Humidity    {HamburgWeather.Humidity} %\n" +
                                     $"Pressure    {HamburgWeather.Pressure} hPa\n" +
                                     $"Windspeed   {HamburgWeather.Windspeed} m/s\n" +
                                     $"WindChill   {HamburgWeather.WindChillIndex} °C\n" +
                                     $"HeatIndex   {HamburgWeather.HeatIndex} °C");  // TODO: here is something wrong - not right value

            Console.WriteLine("-----------------------");

            WeatherData weatherData = new WeatherData();

            CurrentConditionsDisplay currentDisplay    = new CurrentConditionsDisplay(weatherData);
            StatisticsDisplay        statisticsDisplay = new StatisticsDisplay(weatherData);
            ForecastDisplay          forecastDisplay   = new ForecastDisplay(weatherData);
            HeatIndexDisplay         heatIndexDisplay  = new HeatIndexDisplay(weatherData);

            weatherData.SetMeasurements(18, 65, 1012);
            Console.WriteLine("-----------------------");
            weatherData.SetMeasurements(20, 70, 995);
            Console.WriteLine("-----------------------");
            weatherData.SetMeasurements(16, 90, 995);
            Console.WriteLine("--------END------------");

            Console.ReadKey();
        }
コード例 #2
0
        public async Task <IActionResult> Index()
        {
            ViewBag.countries = await _context.Countries.Select(t => t.CountryName).ToListAsync();

            WeatherData nyc    = new WeatherData("New york");
            WeatherData paris  = new WeatherData("Paris");
            WeatherData london = new WeatherData("London");

            nyc.CheckWeather();
            paris.CheckWeather();
            london.CheckWeather();

            ViewData["New-York"] = nyc.ToString();
            ViewData["Paris"]    = paris.ToString();
            ViewData["London"]   = london.ToString();

            return(View());
        }
コード例 #3
0
    public string[] GetyWeatherString(string lang, string lon)
    {
        WeatherData weatherData = new WeatherData(lang, lon);

        weatherData.CheckWeather();

        string[] a = new string[6];

        a[0] = weatherData.City;            // 도시
        a[1] = weatherData.Temp.ToString(); // 평균기온
        a[2] = weatherData.Weather;         // 날씨
        //a[3] = weatherData.WindSpeed.ToString();
        //a[4] = weatherData.WindDirectionName;
        //a[5] = weatherData.Humidity.ToString();

        foreach (var item in a)
        {
            Debug.Log(item);
        }

        return(a);
    }