/// <summary> /// Does the search movie. /// </summary> /// <returns>The search movie.</returns> /// <param name="letter">Letter.</param> async Task DoSearchMovie(string letter) { if (string.IsNullOrEmpty(letter)) { GetLocalMovieList(); return; } var sorted = resultsService.GetAll().Where(x => x.OriginalTitle.ToLowerInvariant().Contains(letter.ToLowerInvariant())) .ToList(); try { if (sorted == null || !sorted.Any()) { sorted = await resultsService .GetAllRemoteData(APIOperations.SearchMovieURLAddres, ConfigureParameters(APIOperations.SearchMovieURLAddres, 1, letter)); sorted = AddImageLinkAndRemoveRepeated(sorted); } Movies = new ObservableCollection <Results>(sorted); } catch (ConnectionException) { uiFunctionsService.HideLoading(); uiFunctionsService.ShowToast(Constants.OfflineMessage, ToastType.Info, 8000); } catch (FetchRemoteDataException) { uiFunctionsService.ShowToast(Constants.GetOnlineDataErrorMessage, ToastType.Error, 8000); GetLocalMovieList(); } catch { mobileCenterCrashesService.AskBeforeSendCrashReport(); uiFunctionsService.ShowToast(Constants.GeneralErrorMessage, ToastType.Warning, 8000); GetLocalMovieList(); } finally { analyticsFunctionsService.TrackEvent(AnalitycsEventsName.SearchMovie, new Dictionary <string, string> { { letter, sorted.Count.ToString() } }); } }
public void OnNavigatingTo(NavigationParameters parameters) { uiFunctionsService.ShowLoading("MessageLoadingMovieDetails"); try { if (parameters.ContainsKey("MOVIE")) { Movie = parameters["MOVIE"] as Results; } } catch { mobileCenterCrashesService.AskBeforeSendCrashReport(); uiFunctionsService.ShowToast(Constants.LoadingMovieDetailsErrorMessage, ToastType.Warning, 8000); _navigationService.GoBackAsync(); } uiFunctionsService.HideLoading(); }