private void OnProgressiveChunkSearchingFailed(ProgressivePhotoSearch sender, Exception exception) { App.Diagnostics.Error.Log("MapContext.SearchAsync", exception); IsSearchButtonEnabled = true; HideProgress((ProgressNotificationId)sender.Tag, Strings.ProgressIndicator_SearchingPhotosResult_Error); if (ActiveProgressiveSearchId == sender.Id) { IsSearchButtonEnabled = true; } }
public Task StartProgressiveSearchAsync(MapViewSettings viewSettings, PhotoTag tag) => Task.Run(() => { if (ProgressiveSearch != null) { ProgressiveSearch.Cancel = true; } ProgressiveSearch = App.Model.Photos.CreateProgressiveSearch(tag, viewSettings.Location, viewSettings.FromDate, viewSettings.ToDate); ActiveProgressiveSearchId = ProgressiveSearch.Id; ProgressiveSearch.ChunkSearchingStarted += OnProgressiveChunkSearchingStarted; ProgressiveSearch.ChunkSearchingCompleted += OnProgressiveChunkSearchingCompleted; ProgressiveSearch.ChunkSearchingFailed += OnProgressiveChunkSearchingFailed; ProgressiveSearch.SearchingFinished += OnProgressiveSearchingFinished; return(ProgressiveSearch.PerformAsync()); });
private void OnProgressiveChunkSearchingCompleted(ProgressivePhotoSearch sender, IEnumerable <Photo> items) { var newPhotos = MergePhotos(items); if (newPhotos.Count > 0) { PhotosAdded(this, newPhotos); } HideProgress((ProgressNotificationId)sender.Tag, Strings.GetProgressIndicatorSearchingPhotosResult(newPhotos.Count)); if (ActiveProgressiveSearchId == sender.Id) { IsSearchButtonEnabled = true; } }