예제 #1
0
        private void ProcessMovies(Cinema cinema, string cinemaName, CinemaType cinemaType)
        {
            var textColor = CinemaColor(cinemaType);
            var group     = new Group <MovieShows>(textColor, cinemaName, cinema.Name.Substring(0, 1) + cinema.City.Substring(0, 2));

            foreach (SimpleMovie movie in cinema.MoviesPlayed)
            {
                if (_filterService.IsActive)
                {
                    if (!_filterService.Check(movie))
                    {
                        continue;
                    }
                }

                string shows = "";
                foreach (var show in movie.Shows)
                {
                    if (show.ShowDate.Date.Equals(DateTime.Today))
                    {
                        shows = shows + show.Start + ", ";
                    }
                }

                string genre = null;
                if (movie.Genre != null)
                {
                    if (movie.Genre.Count > 0)
                    {
                        genre = movie.Genre[0];
                    }
                }

                var             showData = new BasicShowData(cinema.IdCinema, movie.Id, cinemaName, movie.AverageRating);
                MvxAsyncCommand command  = new MvxAsyncCommand(async() =>
                {
                    await _navigationService.Navigate <MovieViewModel, BasicShowData>(showData);
                });

                var movieShows = new MovieShows(movie.Name, genre, shows, movie.AverageRating, command);
                group.Add(movieShows);
            }

            if (group.Count != 0)
            {
                Repertoires.Add(group);
            }
        }