private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e) { Exception AppException = null; LoadingControl.DisplayLoadingError(false); LoadingControl.SetLoadingStatus(true); try { supermarkt = Supermarkt.Deserialize(e.NavigationParameter as string); this.DataContext = supermarkt; supermarkt.ProductPagina = await GetSAData.GetDiscountsFromSupermarket(supermarkt, false); this.ProductsLV.DataContext = supermarkt.ProductPagina.Producten; DiscountVallidTextbox.Text = supermarkt.ProductPagina.DiscountValid; try { if (SelectedItem != null) { foreach (Product p in supermarkt.ProductPagina.Producten) { if (p.ID == SelectedItem.ID) { supermarkt.ProductPagina.SelectedItem = p; SelectedItem = null; ProductsLV.SelectedItem = p; break; } } ProductsLV.ScrollIntoView(supermarkt.ProductPagina.SelectedItem); } } catch { } } catch (Exception ex) { AppException = ex; LoadingControl.DisplayLoadingError(true); } finally { Task t = Task.Run(() => ClientIDHandler.instance.PostAppStats(ClientIDHandler.AppName.Supermarkt_Aanbiedingen)); LoadingControl.SetLoadingStatus(false); } if (AppException != null) { Task t = Task.Run(() => ExceptionHandler.instance.PostException(new AppException(AppException), (int)ClientIDHandler.AppName.Supermarkt_Aanbiedingen)); } }
void searchTextChanged(object sender, Xamarin.Forms.TextChangedEventArgs e) { ProductsLV.BeginRefresh(); if (string.IsNullOrWhiteSpace(e.NewTextValue)) { ProductsLV.ItemsSource = viewModel.ProductsCollection; } else { ProductsLV.ItemsSource = viewModel.ProductsCollection.Where(i => i.Name.Contains(e.NewTextValue)); } ProductsLV.EndRefresh(); }