private async void InitSections() { // init marcas ObservableCollection <Item> items = new ObservableCollection <Item>(); var listmarcas = new SimpleListPage(items) { Title = "Marcas", RowHeight = 80 }; listmarcas.ItemSelected += Listmarcas_ItemSelected; Children.Add(listmarcas); ObservableCollection <Item> itemscategorias = new ObservableCollection <Item>(); var categorias = new SimpleListPage(itemscategorias) { Title = "Categorias", RowHeight = 80 }; categorias.ItemSelected += Categorias_ItemSelected; Children.Add(categorias); var mainpage = new MainPage() { Title = "Busqueda" }; Children.Add(mainpage); if (CrossConnectivity.Current.IsConnected) { var catalogos = await App.RestClient.Get <Catalogos>($"{App.BaseUrl}/Catalogo/get/{App.IdCliente}", new Dictionary <string, object>()); if (catalogos != null) { if (catalogos.Marcas != null && catalogos.Marcas.Count > 0) { SetListMarcas(catalogos.Marcas, catalogos.Modelos, items); } if (catalogos.Categorias != null && catalogos.Categorias.Count > 0) { SetCategorias(catalogos.Categorias, itemscategorias); } } else { await DisplayAlert(App.AppName, "No pudimos contactar con la tienda, intente más tarde", "Aceptar"); } } else { await DisplayAlert(App.AppName, "Verifica tu conexión a internet", "Aceptar"); } }
private void Listmarcas_ItemSelected(object sender, Item e) { if (e.Childs != null && e.Childs.Count > 0) { ObservableCollection <Item> itemsmodelos = new ObservableCollection <Item>(); var modelos = new SimpleListPage(itemsmodelos) { Title = e.Title, RowHeight = 80 }; foreach (var item in e.Childs) { itemsmodelos.Add(item); } modelos.ItemSelected += Modelos_ItemSelected; Navigation.PushAsync(modelos); } }