예제 #1
0
 public IEnumerable <string> GetMovieTitles(string query)
 {
     return(AllMovies
            .Where(c => c.Title.IndexOf(query, StringComparison.CurrentCultureIgnoreCase) > -1)
            .OrderByDescending(c => c.Title.StartsWith(query, StringComparison.CurrentCultureIgnoreCase))
            .Select(c => c.Title).Distinct());
 }
예제 #2
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();
        }
예제 #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();
        }
        private async void OpenNavigationView(OpenNavigationViewEventArgs args)
        {
            await LoadAsync();

            var subscription = await _subscriptionRepository.GetByIdAsync(args.Id);

            var movie = await _movieRepository.GetByIdAsync(subscription.MovieId);

            var movieWrpper = AllMovies.Where(m => m.Id == movie.Id).FirstOrDefault();

            if (movieWrpper != null)
            {
                SelectedMovie = movieWrpper;
            }
        }
 private async void OpenAndFilterNavigationView(OpenAndFilterNavigationViewEventArgs args)
 {
     if (String.IsNullOrEmpty(args.SelectedItem))
     {
         await LoadAsync();
     }
     else
     {
         var filteredMovies           = AllMovies.Where(m => m.Name.ToLower().StartsWith(args.SelectedItem.ToLower()));
         List <MovieWrapper> tempList = new List <MovieWrapper>();
         foreach (var filteredMovie in filteredMovies)
         {
             tempList.Add(filteredMovie);
         }
         AllMovies.Clear();
         foreach (var item in tempList)
         {
             AllMovies.Add(item);
         }
     }
 }