Esempio n. 1
0
        // Populate movie details page after clicking on listview item
        private void MovieList_ItemActivate(object sender, EventArgs e)
        {
            if (MovieList.SelectedItems.Count == 1)
            {
                Movie currentMovie = MovieManager.getInstance().getMovieByNameAndRelease(
                    MovieList.SelectedItems[0].SubItems[0].Text,
                    Int32.Parse(MovieList.SelectedItems[0].SubItems[1].Text));

                movieDetailsPosterImg.Image  = Image.FromFile(currentMovie.getPicFilepath());
                movieDetailsNameAndYear.Text = currentMovie.getName() + " (" + currentMovie.getReleaseYear() + ")";
                movieDetailsDescription.Text = currentMovie.getDescription();
                movieDetailsIMDBRating.Text  = "IMDB RAting: " + currentMovie.getIMDBRating();
                if (currentMovie.getUserRating() != -1)
                {
                    movieDetailsUserRating.Text = "User Rating: " + currentMovie.getUserRating();
                }
                else
                {
                    movieDetailsUserRating.Text = "User Rating: N/A";
                }
                movieDetailsWatched.Text = "Watched: " + currentMovie.getWatched();

                movieDetailsNameAndYear.Font = new Font(movieDetailsNameAndYear.Font, FontStyle.Bold);
                movieDetailsPosterImg.Show();
                movieDetailsNameAndYear.Show();
                movieDetailsDescription.Show();
                movieDetailsIMDBRating.Show();
                movieDetailsUserRating.Show();
                movieDetailsWatched.Show();
            }
        }
Esempio n. 2
0
 private void ResetSearchButton_Click(object sender, EventArgs e)
 {
     MovieManager.getInstance().clearFilteredMovies();
     MovieManager.getInstance().setFilteredMovies(MovieManager.getInstance().getMovies().ToList());
     populateListView();
     searchInputTextBox.Text = "";
 }
Esempio n. 3
0
 public void updateList()
 {
     MovieManager.getInstance().clearFilteredMovies();
     MovieManager.getInstance().setFilteredMovies(MovieManager.getInstance().getMovies().ToList());
     populateListView();
     searchInputTextBox.Text = "";
 }
Esempio n. 4
0
        // Populate ListView with Movie data
        private void populateListView()
        {
            MovieList.Items.Clear();
            imgList.ImageSize        = new Size(100, 150);
            MovieList.SmallImageList = null;
            MovieList.LargeImageList = imgList;
            for (int i = 0; i < MovieManager.getInstance().getFilteredMovies().Count; i++)
            {
                ListViewItem lvi = new ListViewItem(MovieManager.getInstance().getFilteredMovies()[i].getName());
                lvi.SubItems.Add(MovieManager.getInstance().getFilteredMovies()[i].getReleaseYear().ToString());

                if (MovieManager.getInstance().getFilteredMovies()[i].getUserRating() != -1)
                {
                    lvi.SubItems.Add(MovieManager.getInstance().getFilteredMovies()[i].getUserRating().ToString());
                }
                else
                {
                    lvi.SubItems.Add("N/A");
                }

                if (MovieManager.getInstance().getFilteredMovies()[i].getIMDBRating() != -1)
                {
                    lvi.SubItems.Add(MovieManager.getInstance().getFilteredMovies()[i].getIMDBRating().ToString());
                }
                else
                {
                    lvi.SubItems.Add("N/A");
                }

                lvi.SubItems.Add(MovieManager.getInstance().getFilteredMovies()[i].getFilepath());
                lvi.SubItems.Add(MovieManager.getInstance().getFilteredMovies()[i].getPicFilepath());
                lvi.ImageIndex = MovieManager.getInstance().getFilteredMovies()[i].getImgIndex();
                MovieList.Items.Add(lvi);
            }
        }
Esempio n. 5
0
        private void button2_Click(object sender, EventArgs e)
        {
            //imgList.ImageSize = new Size(100, 100);

            //string imgPath = System.AppDomain.CurrentDomain.BaseDirectory + "..\\..\\..\\imgs";
            //string[] images = System.IO.Directory.GetFiles(@imgPath, "*.png", System.IO.SearchOption.AllDirectories);

            //// Store all images from the imgs directory to the images array
            //for (int i = 0; i < images.Length; i++)
            //{
            //    imgList.Images.Add(i.ToString(), Image.FromFile(images[i]));
            //}

            //// Put all images from image array to ListView
            //for (int j = 0; j < images.Length; j++)
            //{
            //    ListViewItem lvi = new ListViewItem();
            //    lvi.ImageIndex = j;
            //    someIMGList.Items.Add(lvi);
            //}

            //// Set the image lists for the ListView
            //someIMGList.SmallImageList = imgList;
            //someIMGList.LargeImageList = imgList;

            EditMovie editMovie = new EditMovie(this, dbMovies);

            if (MovieList.SelectedItems.Count == 1)
            {
                editMovie.setSelectedMovie(MovieManager.getInstance().getMovieByNameAndRelease(
                                               MovieList.SelectedItems[0].SubItems[0].Text,
                                               Int32.Parse(MovieList.SelectedItems[0].SubItems[1].Text)));
                editMovie.Show();
            }
        }
Esempio n. 6
0
 public static MovieManager getInstance()
 {
     if (instance == null)
     {
         instance = new MovieManager();
     }
     return(instance);
 }
Esempio n. 7
0
 // Filters the movies shown in the ListView dependant on the input search text
 private void searchButton_Click(object sender, EventArgs e)
 {
     MovieManager.getInstance().clearFilteredMovies();
     for (int i = 0; i < MovieManager.getInstance().getMovies().Count; i++)
     {
         if (MovieManager.getInstance().getMovies()[i].getName().ToLower().Contains(searchInputTextBox.Text.ToLower()))
         {
             MovieManager.getInstance().addFilteredMovie(MovieManager.getInstance().getMovies()[i]);
         }
     }
     populateListView();
 }
Esempio n. 8
0
 // Populate the MovieManager object with the movie data found in the database
 private void getMovieDBData()
 {
     MovieManager.getInstance().clearMovies();
     MovieManager.getInstance().clearFilteredMovies();
     for (int i = 0; i < dbMovies.Tables["Movies"].Rows.Count; i++)
     {
         Movie tempMovie = new Movie(dbMovies.Tables["Movies"].Rows[i]["MovieName"].ToString(),
                                     dbMovies.Tables["Movies"].Rows[i]["Description"].ToString(),
                                     Int32.Parse(dbMovies.Tables["Movies"].Rows[i]["ReleaseYear"].ToString()),
                                     double.Parse(dbMovies.Tables["Movies"].Rows[i]["UserRating"].ToString()),
                                     double.Parse(dbMovies.Tables["Movies"].Rows[i]["IMDBRating"].ToString()),
                                     dbMovies.Tables["Movies"].Rows[i]["Path"].ToString(),
                                     dbMovies.Tables["Movies"].Rows[i]["PicturePath"].ToString(),
                                     Boolean.Parse(dbMovies.Tables["Movies"].Rows[i]["Watched"].ToString())
                                     );
         tempMovie.setImgIndex(i);
         MovieManager.getInstance().addMovie(tempMovie);
         MovieManager.getInstance().addFilteredMovie(tempMovie);
         imgList.Images.Add(Image.FromFile(dbMovies.Tables["Movies"].Rows[i]["PicturePath"].ToString()));
     }
 }
Esempio n. 9
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            var checkedButton = UserRatingGroupBox.Controls.OfType <RadioButton>()
                                .FirstOrDefault(r => r.Checked);

            // Edit user rating of the movie
            if (checkedButton != null)
            {
                updateDB(NameTextBox.Text, Int32.Parse(ReleaseYearTextBox.Text),
                         Int32.Parse(checkedButton.Name.Replace("UserRatingRadioButton", "")), WatchedRadioButtonYes.Checked);
                MovieManager.getInstance().setMovieUserRating(SelectedMovie.getName(),
                                                              Int32.Parse(checkedButton.Name.Replace("UserRatingRadioButton", "")));
            }
            else
            {
                updateDB(NameTextBox.Text, Int32.Parse(ReleaseYearTextBox.Text), -1, WatchedRadioButtonYes.Checked);
            }

            // Edit movie name
            MovieManager.getInstance().setMovieName(SelectedMovie.getName(), NameTextBox.Text);

            // Edit movie release date
            MovieManager.getInstance().setMovieReleaseYear(SelectedMovie.getName(),
                                                           Int32.Parse(ReleaseYearTextBox.Text));

            // Edit if movie has been watched
            if (WatchedRadioButtonYes.Checked)
            {
                MovieManager.getInstance().setMovieWatched(SelectedMovie.getName(), true);
            }
            else
            {
                MovieManager.getInstance().setMovieWatched(SelectedMovie.getName(), false);
            }

            MainForm.updateList();
            Close();
        }
Esempio n. 10
0
 private void decreasingToolStripMenuItem3_Click(object sender, EventArgs e)
 {
     MovieManager.getInstance().sortMoviesIMDBRatingDecr(0, MovieManager.getInstance().getFilteredMovies().Count - 1);
     populateListView();
 }
Esempio n. 11
0
 private void increasingToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     MovieManager.getInstance().sortMoviesReleaseYearIncr(0, MovieManager.getInstance().getFilteredMovies().Count - 1);
     populateListView();
 }