public async Task ExecuteOnFavoriteCommandAsync(object sender) { PopularBrandsViewModel popularBrandsViewModel = (PopularBrandsViewModel)sender; popularBrandsViewModel.IsFavorite = !popularBrandsViewModel.IsFavorite; PopularBrandsFromServer[PopularBrandsFromServer.IndexOf(popularBrandsViewModel)].IsFavorite = popularBrandsViewModel.IsFavorite; }
public async Task ExecuteOnDeleteCommandAsync(object sender) { PopularBrandsViewModel popularBrandsViewModel = (PopularBrandsViewModel)sender; PopularBrands.Remove(popularBrandsViewModel); PopularBrandsFromServer.Remove(popularBrandsViewModel); }
public async Task ExecuteOnPerformSearchCommandAsync(object sender) { string textToSearch = string.Empty; try { textToSearch = (string)sender; } catch (Exception ex) { SearchBar searchBar = (SearchBar)sender; textToSearch = (searchBar.Text == null) ? "" : searchBar.Text; } PopularBrands = new ObservableCollection <PopularBrandsViewModel>( PopularBrandsFromServer.Where(x => x.ItemTitle.ToUpper().Contains(textToSearch.ToUpper()) || x.Text.ToUpper().Contains(textToSearch.ToUpper()))); }