/// <summary> /// 初始化 /// </summary> private async void InitCategories() { try { if (!Tools.IsNetConnective()) { CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long); return; } //RestSharpService _restSharpService = new RestSharpService(); CategoryRD categoryRD = await RestSharpService.GetCategories(); List <Category> categoryList = categoryRD.result; foreach (var item in categoryList) { if (!item.isParent) { SubCategoryList.Add(item); } } } catch (Exception) { throw; } }
/// <summary> /// 初始化 /// </summary> private async void InitCategories() { try { if (!Tools.IsNetConnective()) { CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long); return; } RestSharpService _restSharpService = new RestSharpService(); CategoryRD categoryRD = await _restSharpService.GetCategories(); categoryViewModel.categoryList = categoryRD.result; foreach (var item in categoryViewModel.categoryList) { if (item.isParent) { categoryViewModel.ParentCategoryList.Add(item); } } ParentStack.Children[0].Behaviors[0].SetValue(RadioBehavior.IsCheckedProperty, true); categoryViewModel.GetSubCategories(categoryViewModel.ParentCategoryList[0].id); } catch (Exception) { throw; } }
private async void InitHomePage() { try { if (!Tools.IsNetConnective()) { CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long); return; } RestSharpService _restSharpService = new RestSharpService(); HomeContentRD homeContentRD = await _restSharpService.GetHomeContent(); CategoryRD categoryRD = await _restSharpService.GetCategories(); //CarouselList = homeContentRD.result[0].panelContents.ToList<HomePanelContent>(); HotProductList = homeContentRD.result[1].panelContents.ToList <HomePanelContent>(); //OfficialChoiceList = homeContentRD.result[2].panelContents.ToList<HomePanelContent>(); //GoodBrandList = homeContentRD.result[3].panelContents.ToList<HomePanelContent>(); //BrandChoiceList = homeContentRD.result[4].panelContents.ToList<HomePanelContent>(); CarouselList = new List <HomePanelContent> { new HomePanelContent { picUrl = "sanye.png", fullUrl = "http://www.sanecn.com/" }, new HomePanelContent { picUrl = "bianselong.jpg", fullUrl = "http://www.cdbsljs.com/" }, new HomePanelContent { picUrl = "jiabei.jpg", fullUrl = "http://www.cdbsljs.com/" } }; List <Category> temp = new List <Category>(); foreach (var item in categoryRD.result) { if (!item.isParent) { temp.Add(item); } } CatList = temp.GetRange(0, 10); } catch (Exception) { throw; } }
/// <summary> /// 初始化 /// </summary> private async void InitCategories() { try { if (!Tools.IsNetConnective()) { CrossToastPopUp.Current.ShowToastError("无网络连接,请检查网络。", ToastLength.Long); return; } RestSharpService _restSharpService = new RestSharpService(); CategoryRD categoryRD = await _restSharpService.GetCategories(); categoryList = categoryRD.result; foreach (var item in categoryList) { if (item.isParent) { ParentCategoryList.Add(item); } } //ParentStack.Children[0].Behaviors[0].SetValue(RadioBehavior.IsCheckedProperty, true); //GetSubCategories(0); //Application.Current.MainPage.FindByName<StackLayout>("ParentStack").Children[0].Behaviors[0].SetValue(RadioBehavior.IsCheckedProperty, true); //GetSubCategories(ParentCategoryList[0].id); //ParentCategoryList[0].Checked = true; //GetSubCategories(ParentCategoryList[0].id); } catch (Exception) { throw; } }