Пример #1
0
        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();
        }
Пример #3
0
        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();
        }
Пример #4
0
        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();
 }