예제 #1
0
        public WeatherModel GetCurrentWeatherByLocation(decimal latitude, decimal longitude)
        {
            var location       = new Location.Location(Settings);
            var currentWeather = location.GetCurrentWeatherByLocation(latitude, longitude);

            var model = new WeatherModel
            {
                CurrentTemperature = decimal.Round(currentWeather.Temperature, 1),
                UnitType           = currentWeather.UnitType.ToString("g").Substring(0, 1).ToUpper(),
                WeatherQueryTime   = currentWeather.WeatherQueryTime,
            };

            return(model);
        }
예제 #2
0
        public MainViewModel GetCurrentWeatherByLocation(decimal latitude, decimal longitude)
        {

            var location = new Location.Location(Settings);
            var currentWeather = location.GetCurrentWeatherByLocation(latitude, longitude);

            var model = new MainViewModel
            {
                MainItems =
                    new List<MainItemViewModel>
                    {
                        new MainItemViewModel{ CityName="Glendale, CA, USA", CurrentTemperature= decimal.Round(currentWeather.Temperature, 1), },
                    },
                UnitType = currentWeather.UnitType.ToString("g").Substring(0, 1).ToUpper(),
            };

            return model;
        }