internal UpcomingMovieViewModel(UpcomingMovieService upcomingMovieService) { _upcomingMovieService = upcomingMovieService ?? throw new ArgumentException("upcomingMovieService"); Title = "TMDb Upcoming Movies"; ListView_ItemsSource = new InfiniteScrollCollection <MovieModel> { OnLoadMore = async() => { try { if (IsBusy) { return(null); } IsBusy = true; var page = (uint)(ListView_ItemsSource.Count / PageSize) + 1; if (totalPages > 0 && page >= totalPages) { IsBusy = false; return(null); } var model = await GetMovieCollectionAsync(page); totalPages = (uint)model.TotalPages; IsBusy = false; return(model.MovieCollection); } catch (Exception ex) { IsBusy = false; Debug.WriteLine(ex); throw; } } }; ListView_RefreshCommand = new Command(async() => await ExecuteListView_RefreshCommand_HandlerAsync()); ToolbarItemSearch_Command = new Command(async() => await ToolbarItemSearch_Command_HandlerAsync()); _ExecuteListView_RefreshCommand_HandlerAsync(); }
/// <summary> /// Constructor. /// </summary> static Singleton() { GenreService = new GenreService(); SearchMovieService = new SearchMovieService(); UpcomingMovieService = new UpcomingMovieService(); }