Esempio n. 1
0
        private void AddMovieButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Movie movieToAdd = new Movie(titleInput.Text, Int32.Parse(releaseYearInput.Text));
                //string tryString = Convert.ToString(releaseYearInput.Text);
            }
            catch
            {
                MessageBox.Show("put in an int");
                titleInput.Clear();
                releaseYearInput.Clear();
                animationStudioInput.Clear();
                animationTypeInput.Clear();
                return;
            }

            //string adjusted = Convert.ToString(releaseYearInput);

            if (animationTypeInput.Text != "" || animationStudioInput.Text != "")
            {
                AnimatedMovie animatedMovieToAdd = new AnimatedMovie(titleInput.Text, Int32.Parse(releaseYearInput.Text), animationStudioInput.Text, animationTypeInput.Text);
                MovieList.Add(animatedMovieToAdd);
                animationStudioInput.Clear();
                animationTypeInput.Clear();
            }
            else
            {
                Movie movieToAdd = new Movie(titleInput.Text, Int32.Parse(releaseYearInput.Text));
                MovieList.Add(movieToAdd);
            }

            titleInput.Clear();
            releaseYearInput.Clear();
        }
Esempio n. 2
0
 private void AddMovies()
 {
     MovieList.Add(new Movie {
         Title = "Bad Boys For Life", Image = "badboys.jpg", Description = "Miami detectives Mike Lowrey and Marcus Burnett must face off against a mother-and-son pair of drug lords who wreak vengeful havoc on their city."
     });
     MovieList.Add(new Movie {
         Title = "White House Down", Image = "whitehousedown.jpg", Description = "While on a tour of the White House with his young daughter, a Capitol policeman springs into action to save his child and protect the president from a heavily armed group of paramilitary invaders."
     });
     MovieList.Add(new Movie {
         Title = "Avengers", Image = "avengers.jpg", Description = "With the help of remaining allies, the Avengers assemble once more in order to reverse Thanos' actions and restore balance to the universe."
     });
     MovieList.Add(new Movie {
         Title = "Central Intelligence", Image = "centralintelligence.jpg", Description = "After he reconnects with an awkward pal from high school through Facebook, a mild-mannered accountant is lured into the world of international espionage."
     });
     MovieList.Add(new Movie {
         Title = "The Godfather", Image = "godfather.jpg", Description = "The aging patriarch of an organized crime dynasty transfers control of his clandestine empire to his reluctant son."
     });
     MovieList.Add(new Movie {
         Title = "Hunter Killer", Image = "hunterkiller.jpg", Description = "An untested American submarine captain teams with U.S. Navy Seals to rescue the Russian president, who has been kidnapped by a rogue general."
     });
     MovieList.Add(new Movie {
         Title = "Jumanji", Image = "jumanji.jpg", Description = "Four teenagers are sucked into a magical video game, and the only way they can escape is to work together to finish the game."
     });
     MovieList.Add(new Movie {
         Title = "Safe Haven", Image = "safehaven.jpg", Description = "A young woman with a mysterious past lands in Southport, North Carolina where her bond with a widower forces her to confront the dark secret that haunts her."
     });
     MovieList.Add(new Movie {
         Title = "Girls Trip", Image = "girlstrip", Description = "When four lifelong friends travel to New Orleans for the annual Essence Festival, sisterhoods are rekindled, wild sides are rediscovered, and there's enough dancing, drinking, brawling and romancing to make the Big Easy blush."
     });
 }
Esempio n. 3
0
        public void AddNewMovie()
        {
            Movie tempMovie = new Movie();

            tempMovie.MovieTitle    = NewMovie.MovieTitle;
            tempMovie.Genre         = NewMovie.Genre;
            tempMovie.DateOfRelase  = NewMovie.DateOfRelase;
            tempMovie.MovieDirector = NewMovie.MovieDirector;

            if (string.IsNullOrEmpty(NewMovie.MovieTitle))
            {
                MessageDialog noTitle = new MessageDialog("You must add a title!");
                noTitle.Commands.Add(new UICommand {
                    Label = "Ok"
                });
                noTitle.ShowAsync().AsTask();
            }
            else if (NewMovie.DateOfRelase.All(char.IsDigit) == false)
            {
                MessageDialog notNumber = new MessageDialog("Release must be a number!");
                notNumber.Commands.Add(new UICommand {
                    Label = "Ok"
                });
                notNumber.ShowAsync().AsTask();
            }
            else
            {
                movieList.Add(tempMovie);
            }
        }
        private void  GetMovies()
        {
            var list = service.GetMovies("");

            MovieList.Clear();
            foreach (Movie mov in list)
            {
                MovieList.Add(mov);
            }
        }
Esempio n. 5
0
        private void LoadMovies(bool reset)
        {
            if (reset)
            {
                MoviesVisibility = Visibility.Collapsed;
                LoaderVisibility = Visibility.Visible;
                MovieList.Clear();
                _currentPage = 1;
            }
            else
            {
                IsLoading = true;
            }
            BackgroundWorker loader = new BackgroundWorker();

            loader.DoWork += (sender, e) =>
            {
                try
                {
                    var lista = MovieRepository.Yify.ListMovies(page: _currentPage /*, quality: _selectedQuality*/, sortBy: _selectedSort, orderBy: _selectedOrder, queryTerm: _queryString);
                    e.Result = lista;
                }
                catch (WebException)
                {
                    e.Cancel = true;
                }
            };
            loader.RunWorkerCompleted += (sender, e) =>
            {
                if (!e.Cancelled)
                {
                    Dispatcher.CurrentDispatcher.Invoke(() =>
                    {
                        var movies = (IEnumerable <Movie>)e.Result;
                        if (movies.Count() > MovieList.Count)
                        {
                            foreach (var movie in (IEnumerable <Movie>)e.Result)
                            {
                                MovieList.Add(new HomeMovieItem(movie));
                            }
                        }
                    });
                    _currentPage++;
                    IsLoading        = false;
                    LoaderVisibility = Visibility.Collapsed;
                    MoviesVisibility = Visibility.Visible;
                }
                else
                {
                    LoaderVisibility = Visibility.Collapsed;
                    ModernDialog.ShowMessage("No internet connection!" + Environment.NewLine + "Please restart the application with internet access.", "No internet access!", MessageBoxButton.OK);
                }
            };
            loader.RunWorkerAsync();
        }
Esempio n. 6
0
 public async override void OnNavigatingTo(NavigationParameters parameters)
 {
     if (parameters.ContainsKey("DeletedMovieInfo"))
     {
         MovieList.Remove((MovieInfo)parameters["DeletedMovieInfo"]);
     }
     if (parameters.ContainsKey("EditedMovieInfo"))
     {
         MovieList.Remove((MovieInfo)parameters["UpdatedMovieInfo"]);
         MovieList.Add((MovieInfo)parameters["UpdatedMovieInfo"]);
     }
 }
        public IMovieList ChooseBest()
        {
            MovieList cinePlexMovies = new MovieList();

            if (_movies.Any())
            {
                var context = CreateSolver();

                Solution solution = context.Solve(new SimplexDirective());

                var     decision   = solution.Decisions.First();
                var     fmlBuxUsed = 0;
                decimal estimatedBoxOfficeTotal             = 0;
                var     screensUsed                         = 0;
                Dictionary <string, MsfMovieWrapper> movies = _movies.ToDictionary(p => p.Name);

                foreach (var v in decision.GetValues())
                {
                    int count = Convert.ToInt32(v.GetValue(0));
                    var title = Convert.ToString(v.GetValue(1));
                    var movie = movies[title];

                    if (count > 0)
                    {
                        screensUsed             += count;
                        fmlBuxUsed              += (int)(count * movie.Cost);
                        estimatedBoxOfficeTotal += (count * movie.Earnings);

                        for (int i = 0; i < count; i++)
                        {
                            cinePlexMovies.Add(movie);
                        }
                    }
                }

                decimal penalty = (AvailableScreens - screensUsed) * PenaltyForUnusedScreens;

                if (DisplayDebugMessage)
                {
                    Console.WriteLine($"Total Estimated BoxOffice:\t${estimatedBoxOfficeTotal:n} M Total FmlBux spent: ${fmlBuxUsed:n} Screens utilized: {screensUsed} Total Penalty: ${penalty:n} M");
                    Console.WriteLine($"Cineplex Total: \t\t\t\t\t\t\t\t\t${estimatedBoxOfficeTotal - penalty:n} M");

                    Console.WriteLine();
                    Console.WriteLine();

                    Report report = solution.GetReport();
                    Console.WriteLine(report.ToString());
                }
            }

            return(cinePlexMovies);
        }
Esempio n. 8
0
        private async void AddMessageToList()
        {
            ButtonEnabled = false;
            _newMovie     = new MovieInfo();
            _newMovie     = await MovieInfoManager.GetTasksAsync(Name);

            // Add movie to SQLite database
            await App.Database.SaveMovieInfoAsync(_newMovie);

            // Add movie to memory collection
            MovieList.Add(_newMovie);
            ButtonEnabled = true;
        }
Esempio n. 9
0
        public async Task LoadMoreMovies()
        {
            IEnumerable <Movie> movies;

            try
            {
                if (IsSearchingMode)
                {
                    movies = await _movieRepository.FindMovies(SearchText);
                }
                else
                {
                    movies = await _movieRepository.GetMovies(_nextPageOfMoviesToLoad);
                }
            }
            catch (Exception)
            {
                movies = null;
            }

            SwitchRefreshVisibility?.Invoke(movies == null);

            if (movies == null)
            {
                ToastText = "No internet = no movies. Please turn it on.";
                AnimateToast?.Invoke();
                return;
            }

            if (IsSearchingMode)
            {
                MovieList.Clear();
            }
            else
            {
                _nextPageOfMoviesToLoad++;
            }

            foreach (var newMovie in movies)
            {
                MovieList.Add(newMovie);
            }
        }
Esempio n. 10
0
        public void SearchSelected()
        {
            SearchText      = "";
            IsSearchingMode = !IsSearchingMode;

            if (IsSearchingMode)
            {
                _previousSearchQuery   = "";
                _copyOfPreSearchMovies = MovieList.ToList();
                MovieList.Clear();
            }
            else
            {
                MovieList.Clear();
                foreach (var movieCopy in _copyOfPreSearchMovies)
                {
                    MovieList.Add(movieCopy);
                }
            }
        }
Esempio n. 11
0
        //Ha az oldalra érkezik
        public override async Task OnNavigatedToAsync(
            object parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            //Movie és Serie szervíz elérése, adatok letöltéséhez
            //Top-okat adja mindkét kategóriában vissza
            var movieservice = new MovieService();
            var movieGroups  = await movieservice.GetTopratedMoviesAsync();

            foreach (var item in movieGroups.results)
            {
                MovieList.Add(item);
            }
            var seriesservice = new SeriesService();
            var seriesGroups  = await seriesservice.GetTopSeriesAsync();

            foreach (var item in seriesGroups.results)
            {
                SeriesList.Add(item);
            }

            await base.OnNavigatedToAsync(parameter, mode, state);
        }
Esempio n. 12
0
        /// <summary>
        ///     Adds a movie to the movie list.
        /// </summary>
        /// <param name="title"></param>
        /// <param name="genre"></param>
        /// <param name="releaseYear"></param>
        public static void AddMovie()
        {
            Console.WriteLine("Title:");
            var title = Console.ReadLine();

            Console.WriteLine("Genre:");
            var genre = Console.ReadLine();

            Console.WriteLine("Release Year:");
            uint releaseYear;
            var  success = uint.TryParse(Console.ReadLine(), out releaseYear);

            if (success)
            {
                MovieList.Add(new Movie(movieId, title, genre, releaseYear));
            }
            else
            {
                MovieList.Add(new Movie(movieId, title, genre, 0));
            }

            movieId++;
        }
Esempio n. 13
0
        //Beérkezésre mi történjen
        public override async Task OnNavigatedToAsync(
            object parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            var searchquery = (string)parameter;

            //Filmek és sorozatok keresése string alapján
            var movieservice  = new MovieService();
            var seriesService = new SeriesService();
            var movieGroups   = await movieservice.SearchMovieAsync(searchquery);

            foreach (var item in movieGroups.results)
            {
                MovieList.Add(item);
            }
            var seriesGroups = await seriesService.SearchSeriesAsync(searchquery);

            foreach (var item in seriesGroups.results)
            {
                SeriesList.Add(item);
            }

            await base.OnNavigatedToAsync(parameter, mode, state);
        }
        public async Task LoadMTVS(string sortType = "desc")
        {
            List <MovieAndTvshowPerson> listCast = await _CastService.Get <List <Data.Model.MovieAndTvshowPerson> >(new MovieAndTvshowPersonSearchRequest()
            {
                PersonId = person.Id,
            });

            if (sortType == "desc")
            {
                listCast = listCast.GroupBy(p => p.MovieAndTvshowId)
                           .Select(g => g.First()).OrderByDescending(x => x.MovieAndTvshow.ReleaseDate).ToList();
            }
            else
            {
                listCast = listCast.GroupBy(p => p.MovieAndTvshowId)
                           .Select(g => g.First()).OrderBy(x => x.MovieAndTvshow.ReleaseDate).ToList();
            }

            MovieList.Clear();
            foreach (var person in listCast)
            {
                MovieList.Add(person);
            }
        }
        public List <IMovieList> ChooseBest(int topCount)
        {
            var result = new List <IMovieList>();

            if (_movies.Any())
            {
                var      context  = CreateSolver();
                Solution solution = context.Solve(new SimplexDirective());
                //Solution solution = context.Solve(new ConstraintProgrammingDirective());
                //Solution solution = context.Solve();

                Dictionary <string, MsfMovieWrapper> movies = _movies.ToDictionary(p => p.Name);

                if (topCount > 1)
                {
                    // For now only do this once.
                    topCount = 1;
                }

                while (topCount > 0)
                {
                    var decision = solution.Decisions.First();

                    var     fmlBuxUsed = 0;
                    decimal estimatedBoxOfficeTotal = 0;
                    var     screensUsed             = 0;

                    MovieList cinePlexMovies = new MovieList();

                    foreach (var v in decision.GetValues())
                    {
                        int count = Convert.ToInt32(v.GetValue(0));
                        var title = Convert.ToString(v.GetValue(1));
                        var movie = movies[title];

                        if (count > 0)
                        {
                            screensUsed             += count;
                            fmlBuxUsed              += (int)(count * movie.Cost);
                            estimatedBoxOfficeTotal += (count * movie.Earnings);

                            for (int i = 0; i < count; i++)
                            {
                                cinePlexMovies.Add(movie);
                            }
                        }
                    }

                    decimal penalty = (AvailableScreens - screensUsed) * PenaltyForUnusedScreens;

                    if (DisplayDebugMessage)
                    {
                        Console.WriteLine($"Total Estimated BoxOffice:\t${estimatedBoxOfficeTotal:n} M Total FmlBux spent: ${fmlBuxUsed:n} Screens utilized: {screensUsed} Total Penalty: ${penalty:n} M");
                        Console.WriteLine($"Cineplex Total: \t\t\t\t\t\t\t\t\t${estimatedBoxOfficeTotal - penalty:n} M");

                        Console.WriteLine();
                        Console.WriteLine();

                        Report report = solution.GetReport();
                        Console.WriteLine(report.ToString());
                    }

                    if (!result.Any() || result.Last().TotalEarnings > cinePlexMovies.TotalEarnings)
                    {
                        result.Add(cinePlexMovies);
                    }

                    solution.GetNext();
                    topCount--;
                }
            }
            else
            {
                // Add an empty one if there are no picks/movies

                result.Add(new MovieList());
            }

            return(result);
        }
Esempio n. 16
0
 //Add movie
 public static void AddMovie(Movie newMovie)
 {
     MovieList.Add(newMovie);
 }
Esempio n. 17
0
        public static void Main(string[] args)
        {
            var cinemaProgram = new MovieList();

            var director = new Person()
            {
                Name = "Denis Villeneuve"
            };

            var leadRole = new Person()
            {
                Name = "Ryan Gosling"
            };

            var movie = new Movie()
            {
                Title       = "Blade Runner 2049",
                Director    = director,
                CentralCast = new List <Person>()
                {
                    leadRole
                },
                Year        = 2017,
                PgRating    = PgRating.R,
                Runtime     = 164,
                TicketPrice = 120
            };

            cinemaProgram.Add(movie);

            cinemaProgram.Add(new Movie()
            {
                Title    = "As good as it gets",
                Director = new Person()
                {
                    Name = "James L. Brooks"
                },
                CentralCast = new List <Person>()
                {
                    new Person()
                    {
                        Name = "Jack Nicholson"
                    },
                    new Person()
                    {
                        Name = "Helen Hunt"
                    },
                },
                Year        = 1997,
                PgRating    = PgRating.PG13,
                Runtime     = 139,
                TicketPrice = 90
            });

            Console.WriteLine($"The movie list contains {cinemaProgram.Count()} movies: ");
            Console.WriteLine($"-------------------------------------------------------");
            Console.WriteLine("");

            cinemaProgram.PrintList();

            Console.ReadKey();
        }