public MainPageViewModel() { MessagingCenter.Subscribe <MenuPageViewModel, string>(this, "SelectedGenre", (sender, selectedGenre) => { DetailPageViewModel.Movies = AllMovies.Where(m => m.Genre.Contains(MenuPageViewModel.SelectedGenre)).ToList(); }); MenuPageViewModel = new MenuPageViewModel(); DetailPageViewModel = new DetailPageViewModel(); }
private async Task RefreshAsync() { IsLoading = true; DetailPageViewModel.RefreshCommand.ChangeCanExecute(); AllMovies = new ObservableCollection <Movie>(await MoviesSource.GetMoviesAsync()); MenuPageViewModel.UpdateGenres(); IsLoading = false; DetailPageViewModel.RefreshCommand.ChangeCanExecute(); }
public MainPageViewModel() { MessagingCenter.Subscribe <MenuPageViewModel, string>(this, "SelectedGenre", (sender, selectedGenre) => { DetailPageViewModel.Movies = AllMovies.Where(m => m.Genre.Contains(MenuPageViewModel.SelectedGenre)).ToList(); }); MessagingCenter.Subscribe <AddMoviePageViewModel>(this, "RefreshMovies", async sender => await RefreshAsync()); MessagingCenter.Subscribe <DetailPageViewModel>(this, "RefreshMovies", async sender => await RefreshAsync()); MenuPageViewModel = new MenuPageViewModel(); DetailPageViewModel = new DetailPageViewModel(); }
public async Task OnAppearingAsync() { AllMovies = await MoviesSource.GetMoviesAsync(); MenuPageViewModel.UpdateGenres(); }
public async Task OnAppearingAsync() { // TODO Uncomment // AllMovies = new ObservableCollection<Movie>(await MoviesSource.GetMoviesAsync()); MenuPageViewModel.UpdateGenres(); }