Ejemplo n.º 1
0
        private async Task SelectMovie(MovieTitleViewModel movieTitle)
        {
            if (movieTitle == null)
            {
                return;
            }

            SelectedMovie = null;

            var viewModel = new MovieTitleDetailViewModel(movieTitle, this.movieStore, this.pageService);

            viewModel.MovieUpdated += (source, updatedMovie) =>
            {
                movieTitle.Id = updatedMovie.Id;
                movieTitle.TitleReleaseDate = updatedMovie.TitleReleaseDate;
                movieTitle.Title            = updatedMovie.Title;
                movieTitle.MovieDesc        = updatedMovie.MovieDesc;
                movieTitle.ReleaseDate      = updatedMovie.ReleaseDate;
                movieTitle.ImdbUrl          = updatedMovie.ImdbUrl;
                movieTitle.StorageType      = updatedMovie.StorageType;
                movieTitle.DateAdded        = updatedMovie.DateAdded;
                movieTitle.DateModified     = updatedMovie.DateModified;
            };

            await this.pageService.PushAsync(new MovieTitleDetailView(viewModel));
        }
        public MovieTitleDetailViewModel(MovieTitleViewModel viewModel, BaseMovieTitleStore movieStore, IPageService pageService)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            this.pageService     = pageService;
            this.movieTitleStore = movieStore;

            this.SaveCommand = new Command(async() => await Save());

            MovieTitle = new MovieTitle
            {
                Id = viewModel.Id,
                TitleReleaseDate = viewModel.TitleReleaseDate,
                Title            = viewModel.Title,
                MovieDesc        = viewModel.MovieDesc,
                ReleaseDate      = viewModel.ReleaseDate,
                ImdbUrl          = viewModel.ImdbUrl,
                StorageType      = viewModel.StorageType,
                DateAdded        = viewModel.DateAdded,
                DateModified     = viewModel.DateModified,
            };
        }
Ejemplo n.º 3
0
        private async Task DeleteMovie(MovieTitleViewModel movieTitleViewModel)
        {
            if (await this.pageService.DisplayAlert("Warning", $"Are you sure you want to delete {movieTitleViewModel.Title}?", "Yes", "No"))
            {
                Movies.Remove(movieTitleViewModel);

                var movie = await this.movieStore.GetMovie(movieTitleViewModel.Id);

                await this.movieStore.DeleteMovieTitle(movie);
            }
        }