Exemplo n.º 1
0
        /// <summary>
        /// Refresh function which shall be called on unit change
        /// </summary>
        /// <returns></returns>
        public async Task Update()
        {
            listWeatherData.Clear();
            WeatherData_ListVM newItem = new WeatherData_ListVM(new WeatherData());

            var location = await LocationManager.GetPosition();

            var ListWeatherElement = await ProcessData.setGeolocation(location.Coordinate.Latitude, location.Coordinate.Longitude, "List", Requnits);

            listWeatherData.Add((WeatherData_ListVM)ListWeatherElement);
            if (ProcessData.LocToStorage.LocationList != null)
            {
                foreach (var item in ProcessData.LocToStorage.LocationList)
                {
                    newItem            = new WeatherData_ListVM(new WeatherData(item));
                    newItem.ReqWeather = await requestWeather(newItem, Requnits);

                    listWeatherData.Add(newItem);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Populate ListWeatherData list
        /// </summary>
        public async Task init()
        {
            itemSelectedIndex = -1;
            if (!firstuse)
            {
                listWeatherData.Clear();
                this.MainPageInstance = ServiceLocator.Current.GetInstance <MainListWeater_VM>();
                WeatherData_ListVM newItem = new WeatherData_ListVM(new WeatherData());
                listWeatherData.Add((WeatherData_ListVM)LIST_Geolocation);

                if (ProcessData.LocToStorage.LocationList != null)
                {
                    foreach (var item in ProcessData.LocToStorage.LocationList)
                    {
                        newItem            = new WeatherData_ListVM(new WeatherData(item));
                        newItem.ReqWeather = await requestWeather(newItem, Requnits);

                        listWeatherData.Add(newItem);
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// get weather from api
        /// </summary>
        /// <param name="item"></param>
        /// <param name="units"></param>
        /// <returns >RootObject</returns>
        public async Task <RootObject> requestWeather(WeatherData_ListVM item, bool units)
        {
            item.ReqWeather = await OpenWeatherMapProxy.GetWeather(item.Reqlocation, units);

            return(item.ReqWeather);
        }
Exemplo n.º 4
0
 /// <summary>
 /// get weather from api
 /// </summary>
 /// <param name="item"></param>
 /// <param name="units"></param>
 /// <returns></returns>
 public async Task requestWeather_item(WeatherData_ListVM item, bool units)
 {
     item.ReqWeather = await OpenWeatherMapProxy.GetWeather(item.Reqlocation, units);
 }