/// <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; }
public void ClearAll() { PlayerList.Clear(); CityList.Clear(); ArmyList.Clear(); ResearchList.Clear(); DebugList.Clear(); }
private void GetCitiesList() { CityList?.Clear(); if (SelectedStateId.HasValue) { CityList = AsyncHelper.RunSync <IList <City> >(() => CitySelectorService. GetCities(SelectedStateId.Value)); } }
public void RefreshCities() { CityList.Clear(); RequestService.GetCities().ToList().ForEach(c => CityList.Add(c)); OnPropertyChanged(nameof(CityList)); SelectedCity = CityList.FirstOrDefault(); CompanyList.Clear(); RequestService.GetServiceCompanies().ToList().ForEach(c => CompanyList.Add(c)); OnPropertyChanged(nameof(CompanyList)); }
private void GetCitiesList() { CityList?.Clear(); if (SelectedStateId.HasValue) { var items = AsyncHelper.RunSync <IList <City> >(() => CitySelectorService. GetCities(SelectedStateId.Value)); CityList = items.OrderBy(x => x.Name).ToList(); } }
/// <summary> /// Handles the Click event of the clearCityListButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void clearCityListButton_Click(object sender, EventArgs e) { if (Salesman != null) { // ReSharper disable once LocalizableElement StatusLabel.Text = "Cannot alter city list while running"; StatusLabel.ForeColor = Color.Red; return; } CityList.Clear(); DrawCityList(CityList); }
/// <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;//设置区域名称 }
private async Task GetSearchData(string value) { try { var data = await dataService.GetCities(value); if (CityList != null) { CityList.Clear(); } foreach (var item in data) { CityList.Add(item); } } catch (Exception ex) { //await dialogService.ShowMessage(ex.Message, "Notice"); } }