Esempio n. 1
0
        public void OnGet()
        {
            cityid = _weathersettings.Value.Id;
            apikey = _weathersettings.Value.Appid;

            apicall = $"https://api.openweathermap.org/data/2.5/weather?id={cityid}&units=metric&appid={apikey}";

            // Convert all weather properties as .NET objects.
            WeatherConverter converter = new WeatherConverter(apicall);

            Weather = converter.DeserializeJsonFile();
        }
        public void OnGet()
        {
            cityid = _weathersettings.Value.Id;
            apikey = _weathersettings.Value.Appid;

            apicall = $"https://api.openweathermap.org/data/2.5/weather?id={cityid}&units=metric&appid={apikey}";

            // Convert all weather properties as .NET objects.
            WeatherConverter converter = new WeatherConverter(apicall);

            Weather = converter.DeserializeJsonFile();

            // Use the properties as weather widgets
            WeatherWidget widget = new WeatherWidget(Weather);

            // Get the temperature with the celsius symbol for a small widget.
            SmallWidget = widget.SmallWidget();

            // Get the temperature and weather icon for a medium size widget.
            MediumWidget = widget.MediumWidget();

            // Get the city name, temperature, weather icon and weather details for a big widget.
            BigWidget = widget.BigWidget();
        }