private void GetSalesHandler(List <Sale> sales) { _sales = sales; CatalogTableSource catalogSource = new CatalogTableSource(sales, _favoritesProducts, this); catalogSource._workerDelegate = new WeakReference <ICatalogDelegate>(this); catalogTableView.Source = catalogSource; spinner.StopAnimating(); catalogTableView.ReloadData(); }
void FilterAndClose(Category category) { var filteredSales = new List <Sale>(); if (category.Id == 99) { filteredSales = _sales; } else { var filter = new Sale { Name = category.Name }; foreach (var sale in _sales) { foreach (var product in sale.ProductsOnSale) { if (product.CategoryId == category.Id) { filter.ProductsOnSale.Add(product); } } } filteredSales.Add(filter); } CatalogTableSource catalogSource = new CatalogTableSource(filteredSales, _favoritesProducts, this); catalogSource._workerDelegate = new WeakReference <ICatalogDelegate>(this); catalogTableView.Source = catalogSource; catalogTableView.ReloadData(); _selectedCategory = category.Id; alertController.DismissViewController(true, null); }