예제 #1
0
        public static async Task <IList <City> > GetAsync()
        {
            try
            {
                var rest   = new CityRest();
                var result = await rest.GetAsync(string.Empty);

                if (result.IsValid)
                {
                    SetLocalCities(result.Value);
                    return(result.Value);
                }
                else
                {
                    return(GetLocalCities());
                }
            }
            catch (Exception ex)
            {
                var exception = DependencyService.Get <IExceptionService>();
                exception.TrackError(ex, "AccountManager.GetAsync");
                return(new List <City> {
                    DefaultSetting.City
                });
            }
        }
예제 #2
0
        public static async Task <IList <City> > GetAsync()
        {
            var rest   = new CityRest();
            var cities = await rest.GetAsync(string.Empty) ?? GetLocalCities();

            SetLocalCities(cities);
            return(cities);
        }