public void OverGame()
 {
     GameStarted = false;
     CountryList.Clear();
     WrongAnswers = 0;
     RightAnswers = 0;
 }
        /// <summary>
        /// 初始化编辑时地址下拉框
        /// </summary>
        /// <param name="user"></param>
        public void InitialEditAddress(DataOfUserDetial user)
        {
            CountryList.Clear();
            ProvinceList.Clear();
            CityList.Clear();
            AreaList.Clear();
            var countryList = new Areas()
            {
                parent_id = 0, type = 1
            }.GetChildrenList();
            var provinceList = new Areas()
            {
                parent_id = 1 /*user.countryId*/, type = 2
            }.GetChildrenList();
            var cityList = new Areas()
            {
                parent_id = user.provinceId, type = 3
            }.GetChildrenList();
            var areaList = new Areas()
            {
                parent_id = user.cityId, type = 4
            }.GetChildrenList();

            CountryList.AddRange(countryList.ToObservableCollection());
            ProvinceList.AddRange(provinceList.ToObservableCollection());
            CityList.AddRange(cityList.ToObservableCollection());
            AreaList.AddRange(areaList.ToObservableCollection());

            CountryIndex  = 1; //user.countryId;
            ProvinceIndex = user.provinceId;
            CityIndex     = user.cityId;
            AreaIndex     = user.areaId;
        }
        private void GetCountriesList()
        {
            CountryList?.Clear();

            CountryList = AsyncHelper.RunSync <IList <Country> >(() => CitySelectorService.
                                                                 GetCountries());
        }
Exemple #4
0
        private void GetCountriesList()
        {
            CountryList?.Clear();
            var items = AsyncHelper.RunSync <IList <Country> >(() => CitySelectorService.
                                                               GetCountries());

            CountryList = items.OrderBy(x => x.Name).ToList();
        }
 public void ChooseContinent(string continent)
 {
     if (continent != "Все")
     {
         List <Country> countries = GetCountriesByContinent(continent);
         CountryList.Clear();
         CountryList.AddRange(countries);
     }
 }
        private async void GetCountries()
        {
            var response = await RestCountryApi.GetCountries();

            CountryList.Clear();

            foreach (var country in response)
            {
                CountryList.Add(country);
            }
        }
Exemple #7
0
        public override void Dispose()
        {
            if (CancelList != null)
            {
                CancelList.Clear();
                CancelList = null;
            }

            if (CountryList != null)
            {
                CountryList.Clear();
                CountryList = null;
            }

            base.Dispose();
        }
        /// <summary>
        /// 初始化地址
        /// </summary>
        /// <param name="user">对应的用户</param>
        public void InitialViewAddress(DataOfUserDetial user)
        {
            MyDetialPage = 0;
            CountryList.Clear();
            ProvinceList.Clear();
            CityList.Clear();
            AreaList.Clear();
            var countryList = new Areas()
            {
                parent_id = 0, type = 1
            }.GetChildrenList();

            CountryList.AddRange(countryList.ToObservableCollection());
            var currentCoun = countryList.FirstOrDefault(c => c.id == user.countryId);

            DCountry = (currentCoun == null) ? "" : currentCoun.name;//设置国家名称

            var provinceList = new Areas()
            {
                parent_id = user.countryId == 0 ? (1) : (user.countryId), type = 2
            }.GetChildrenList();                                                                                                    //如果未选择国家则默认为中国

            ProvinceList.AddRange(provinceList.ToObservableCollection());
            var currentProvin = provinceList.FirstOrDefault(c => c.id == user.provinceId);

            DProvince = (currentProvin == null) ? "" : currentProvin.name;//设置省份名称

            var cityList = new Areas()
            {
                parent_id = user.provinceId, type = 3
            }.GetChildrenList();

            CityList.AddRange(cityList.ToObservableCollection());
            var cuttentCity = cityList.FirstOrDefault(c => c.id == user.cityId);

            DCity = cuttentCity == null ? "" : cuttentCity.name;//设置城市名称

            var areaList = new Areas()
            {
                parent_id = user.cityId, type = 4
            }.GetChildrenList();

            AreaList.AddRange(areaList.ToObservableCollection());
            var currentArea = areaList.FirstOrDefault(c => c.id == user.areaId);

            DArea = currentArea == null ? "" : currentArea.name;//设置区域名称
        }