public async Task <bool> SearchByText(string textSearch) { Stopwatch stopwatch = Stopwatch.StartNew(); foreach (var listColumn in ListColumns) { listColumn.Clear(); } if (RemoveTile != null) { ListTags.Add(RemoveTile); RemoveTile = null; } if (ListTags.Any(tile => tile.TextSearch.ToLower() == LastQuery.ToLower())) { var tileFind = ListTags.First(tile => tile.TextSearch.ToLower() == LastQuery.ToLower()); RemoveTile = tileFind; ListTags.Remove(tileFind); } Console.WriteLine("Click"); LastQuery = textSearch; var columnsPhoto = await ServiceUnsplash.GetPhoto(numPage, LastQuery); if (!columnsPhoto.Any()) { if (await ServiceUnsplash.client.GetRandomPhoto() == null) { return(false); } } //if (columnsPhoto.Count() == 0) return; var columns = await GetAddedInColumns(columnsPhoto); //if (columnsPhoto.Count() == 0) return false; for (int i = 0; i < countColumns; i++) { // if (ListColumns.Count-1 < i) // ListColumns.Add(new WpfObservableRangeCollection<Photo>(columns[0])); // else ListColumns[i].AddRange(columns[i]); } //ListColumns[0].AddRange(columnsPhoto); //OnPropertyChanged(nameof(ListColumns)); Console.WriteLine("completed"); return(true); }
private async Task <IEnumerable <Photo> > GetNextPhotos() { numPage++; return(await ServiceUnsplash.GetPhoto(numPage, LastQuery)); }