Beispiel #1
0
 private void AddMovieToGrid(FileInfo file)
 {
     if (supportedFileTypes.Contains(file.Extension.ToLower()))
     {
         Movie movie = new Movie();
         movie.title = file.Name.Replace(file.Extension, String.Empty);
         movie.file = file;
         movie.genres = movieDAL.getGenres(movie.title);
         allMovies.Add(movie);
         gridShowMovies.Rows.Add();
         int rowIndex = gridShowMovies.Rows.Count - 1;
         DataGridViewRow row = gridShowMovies.Rows[rowIndex];
         gridShowMovies.Rows[rowIndex].Cells[0].Value = movie.title;
         if (movie.genres.Count > 0)
         {
             DataGridViewComboBoxCell dgvcb = (DataGridViewComboBoxCell)gridShowMovies.Rows[rowIndex].Cells[1];
             foreach (string genre in movie.genres)
             {
                 dgvcb.Items.Add(genre);
             }
             dgvcb.DisplayMember = "this";
             dgvcb.ValueMember = "this";
         }
         else
         {
             SetRowStatus(row, "Could not find Movie");
         }
     }
     else
     {
         MessageBox.Show("Unsupported File Type: " + file.Name);
     }
 }
Beispiel #2
0
        public moviePanel(Movie m,int width,int height)
        {
            this.m = m;
            InitializeComponent();

            this.Size = new System.Drawing.Size(width, height);
            moviePosterBox.Size = new System.Drawing.Size((this.Size.Height * 2) / 3, (this.Size.Height * 3) / 4);
            moviePosterBox.Location = new System.Drawing.Point((this.Size.Width - moviePosterBox.Size.Width) / 2, (this.Size.Width - moviePosterBox.Size.Width) / 4);
            moviePosterBox.ImageLocation = m.Poster;

            movieTitle.Text = m.Title;
            movieTitle.Show();
            resizeTitleText(7.75F);

            this.movieTitle.Location = new System.Drawing.Point((this.Size.Width / 2), moviePosterBox.Location.X + moviePosterBox.Size.Height);
        }
 public WatchItem(Movie sentMovie)
 {
     FlowLayoutPanel recItemHolder = new FlowLayoutPanel();
     Button recItemAdd = new Button();
     recItemAdd.MouseClick +=new MouseEventHandler(recItemAdd_MouseClick);
     recItemAdd.FlatStyle = FlatStyle.Flat;
     recItemAdd.AutoSize = true;
     if (false) //in watchlist
     {
         recItemAdd.Enabled = false;
         recItemAdd.Text = "Already in watchlist";
     }
     else
     {
         recItemAdd.Text = "Add to Watchlist";
     }
     recItemHolder.FlowDirection = FlowDirection.TopDown;
     recItemHolder.Controls.Add(sentMovie.buildThumbnailPanel());
     recItemHolder.Controls.Add(recItemAdd);
     recItemHolder.AutoSize = true;
     recItemAdd.Margin = new Padding(30, 0, 0, 0);
 }
Beispiel #4
0
        public void changeToMoviePage(Movie theMovie)
        {
            currMovie = theMovie;
            DBConnect helper = new DBConnect();
            movieRating = (int)helper.getUserRating(theMovie.getMID(), UID);
               // MessageBox.Show("Rating:" + movieRating.ToString());
            userRated = true;
            if (movieRating == -1)
            {
                userRated = false;
                movieRating = (int)helper.AverageRating(theMovie.getMID());
            }

            addBreadrumbs(this, theMovie.getTitle());
            lblLocation.Text = theMovie.getTitle();
            pnlContent.Controls.Clear();

            //build new big panel

            pnlMovieInfo = new FlowLayoutPanel();
            //pnlMovieInfo = new TableLayoutPanel();
            //pnlMovieInfo.Anchor = AnchorStyles.Top;
            //pnlMovieInfo.Anchor = AnchorStyles.Bottom;
            //pnlMovieInfo.Anchor = AnchorStyles.Left;
            //pnlMovieInfo.Anchor = AnchorStyles.Right;
            //pnlMovieInfo.RowCount = 2;
               // pnlMovieInfo.ColumnCount = 1;
            pnlMovieInfo.BackColor = Color.SteelBlue;
            pnlMovieInfo.Dock = DockStyle.Fill;
               // this.pnlMovieInfo.RowStyles[0].Height = 50F;
            //this.pnlMovieInfo.RowStyles[1].Height = 50F;
            //this.pnlMovieInfo.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));

               pnlMovieInfo.FlowDirection = FlowDirection.TopDown;

            //Add Table panel to divide Movie thumbnail with info
            TableLayoutPanel pnlTopTable = new TableLayoutPanel();
                //pnlTopTable.AutoSize = true;
                pnlTopTable.RowCount = 1;
                pnlTopTable.ColumnCount = 2;
                pnlTopTable.Padding = new Padding(0);
                pnlTopTable.Width = 1000;
                pnlTopTable.Height = 360;
                //pnlTopTable.Dock = DockStyle.Fill;

                pnlTopTable.BackColor = Color.SteelBlue;

                //Add left column contents
                FlowLayoutPanel leftCol = new FlowLayoutPanel();
                leftCol.Padding = new Padding(0);
                leftCol.Dock = DockStyle.Fill;
                leftCol.FlowDirection = FlowDirection.TopDown;
                leftCol.Controls.Add(theMovie.buildThumbnailPanel()); //add thumbnails

                //Create area for ratings
                FlowLayoutPanel ratings = new FlowLayoutPanel();
                ratings.Margin = new Padding(22, 0, 0, 0);
                //ratings.Height = 550;
                //ratings.Width = 550;
                ratings.FlowDirection = FlowDirection.LeftToRight;
                ratings.Padding = new Padding(0);
                ratings.BackColor = Color.SteelBlue;
                PictureBox oneStar = new PictureBox();
                PictureBox twoStar = new PictureBox();
                PictureBox threeStar = new PictureBox();
                PictureBox fourStar = new PictureBox();
                PictureBox fiveStar = new PictureBox();
                oneStar.Size = new Size(25, 26);
                twoStar.Size = new Size(25, 26);
                threeStar.Size = new Size(25, 26);
                fourStar.Size = new Size(25, 26);
                fiveStar.Size = new Size(25, 26);

                oneStar.Margin = new Padding(3);
                twoStar.Margin = new Padding(3);
                threeStar.Margin = new Padding(3);
                fourStar.Margin = new Padding(3);
                fiveStar.Margin = new Padding(3);

                oneStar.Padding = new Padding(0);
                twoStar.Padding = new Padding(0);
                threeStar.Padding = new Padding(0);
                fourStar.Padding = new Padding(0);
                fiveStar.Padding = new Padding(0);

                oneStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                twoStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                threeStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                fourStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                fiveStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");

                stars = new List<PictureBox>();
                stars.Add(oneStar);
                stars.Add(twoStar);
                stars.Add(threeStar);
                stars.Add(fourStar);
                stars.Add(fiveStar);

            //Event listeners
                ratings.MouseLeave += new EventHandler(ratings_MouseLeave);

                oneStar.MouseEnter += new EventHandler(oneStar_MouseEnter);
                twoStar.MouseEnter += new EventHandler(twoStar_MouseEnter);
                threeStar.MouseEnter += new EventHandler(threeStar_MouseEnter);
                fourStar.MouseEnter += new EventHandler(fourStar_MouseEnter);
                fiveStar.MouseEnter += new EventHandler(fiveStar_MouseEnter);

                oneStar.MouseClick += new MouseEventHandler(oneStar_MouseClick);
                twoStar.MouseClick += new MouseEventHandler(twoStar_MouseClick);
                threeStar.MouseClick += new MouseEventHandler(threeStar_MouseClick);
                fourStar.MouseClick += new MouseEventHandler(fourStar_MouseClick);
                fiveStar.MouseClick += new MouseEventHandler(fiveStar_MouseClick);

                Button watchlist = new Button();
                if (helper.inWatchList(theMovie.getMID(),UID))//If in watchlist
                {
                    watchlist.Text = "Remove from Watchlist";

                }
                else
                {
                    watchlist.Text = "Add to Watchlist";
                }
                watchlist.MouseClick += new MouseEventHandler(watchlist_MouseClick);
                //watchlist.AutoSize = true;
                watchlist.Width = 150;
                watchlist.FlatStyle = FlatStyle.Flat;
                //watchlist.Dock = DockStyle.Fill;

                ratings.Controls.Add(oneStar);
                ratings.Controls.Add(twoStar);
                ratings.Controls.Add(threeStar);
                ratings.Controls.Add(fourStar);
                ratings.Controls.Add(fiveStar);
                ratings.Controls.Add(watchlist);

                changeAllStars(movieRating);
                leftCol.Controls.Add(ratings); //add ratings

                pnlTopTable.Controls.Add(leftCol, 0, 0);

                //RIGHT column contents
                FlowLayoutPanel pnlMovieDetails = new FlowLayoutPanel();
                pnlMovieDetails.Margin = new Padding(0, 25, 0, 0);

                pnlMovieDetails.Dock = DockStyle.Fill;
                //pnlMovieDetails.Width = 400;
                //pnlMovieDetails.Width = pnlMovieInfo.Width;
                //pnlMovieDetails.Height = pnlMovieInfo.Height / 2;
                pnlMovieDetails.FlowDirection = FlowDirection.TopDown;

                    //Create Tab Info
                    TabControl details = new TabControl();

                    details.Width = 600;
                    details.Height = 285;
                    //details.Dock = DockStyle.Fill;

                    //Create tab pages
                    TabPage pgActors = new TabPage("Actors");
                    //Fill info into the tab page

                    //Actors Tab
                    FlowLayoutPanel flowActors = new FlowLayoutPanel();
                    flowActors.FlowDirection = FlowDirection.TopDown;
                    pgActors.Controls.Add(flowActors);
                    flowActors.Dock = DockStyle.Fill;

                    List<Actor> actorList = theMovie.getActors();
                    for (int i = 0; i < actorList.Count; i++)
                    {
                        Label lblActor = new Label();
                        lblActor.Text = actorList[i].getName();
                        flowActors.Controls.Add(lblActor);
                    }

                    //Info Tab
                    TabPage pgInfo = new TabPage("Info");
                    //FlowLayoutPanel flowInfo = new FlowLayoutPanel();
                    //flowInfo.FlowDirection = FlowDirection.TopDown;
                    //pgInfo.Controls.Add(flowInfo);
                    //flowInfo.Dock = DockStyle.Fill;
                    Label lblInfo = new Label();
                    lblInfo.Dock = DockStyle.Fill;
                    lblInfo.Text = theMovie.getInfo();
                    pgInfo.Controls.Add(lblInfo);
                    //flowInfo.Controls.Add(lblInfo);

                    //Add tab pages
                    details.TabPages.Add(pgActors);
                    details.TabPages.Add(pgInfo);

                    pnlMovieDetails.Controls.Add(details);

                //add right column contents to table
                    pnlTopTable.Controls.Add(pnlMovieDetails, 1, 0);
            //End of Table Panel

            //Below add another FlowPanel for Reviews

            /*
            FlowLayoutPanel pnlReviewHolder = new FlowLayoutPanel();
            pnlReviewHolder.FlowDirection = FlowDirection.TopDown;

                FlowLayoutPanel pnlReviewHeader = new FlowLayoutPanel();
                Label lblReview = new Label();
                lblReview.Text = "REVIEWS";
                Button toggle = new Button();
                toggle.Text = "Show/Hide";
                toggle.FlatStyle = FlatStyle.Flat;
                /////////////////////////// REMEMBER TO ADD BUTTON LISTENER
                pnlReviewHeader.Controls.Add(lblReview);
                pnlReviewHeader.Controls.Add(toggle);
            //Add stuff to the review holder panel
            pnlReviewHolder.Controls.Add(pnlReviewHeader);
             */

            //Add the two items to the Movie Info Panel
            pnlMovieInfo.Controls.Add(pnlTopTable);
               // pnlMovieInfo.Controls.Add(pnlReviewHolder);
            //pnlMovieInfo.Controls.Add(pnlTopTable, 0, 0);
            //pnlMovieInfo.Controls.Add(pnlReviewHolder, 0, 1);

            //Add everything to the Content Panel
            pnlContent.Controls.Add(pnlMovieInfo);
        }
Beispiel #5
0
        public void changetoRateMovieList()
        {
            if (ratingsDone > 0 || ratingsDone == -1)
            {
                removeBreadcrumbs(null, "");
                lblLocation.Text = "Rating Movies";
                pnlContent.Controls.Clear();

                DBConnect helper = new DBConnect();
                Movie theMovie = helper.selectRandomMovies(1)[0];
                currMovie = theMovie;

                //Panel pnlRate = new Panel();
                //pnlRate.Controls.Add(theMovie.buildThumbnailPanel());
                // pnlRate.Dock = DockStyle.Fill;

                //Add left column contents
                FlowLayoutPanel leftCol = new FlowLayoutPanel();
                leftCol.Padding = new Padding(0);
                leftCol.Dock = DockStyle.Fill;
                leftCol.FlowDirection = FlowDirection.TopDown;

                //Create area for ratings
                FlowLayoutPanel ratings = new FlowLayoutPanel();
                ratings.Margin = new Padding(22, 0, 0, 0);
                //ratings.Height = 550;
                //ratings.Width = 550;
                ratings.FlowDirection = FlowDirection.LeftToRight;
                ratings.Padding = new Padding(0);
                ratings.BackColor = Color.SteelBlue;
                PictureBox starOne = new PictureBox();
                PictureBox starTwo = new PictureBox();
                PictureBox starThree = new PictureBox();
                PictureBox starFour = new PictureBox();
                PictureBox starFive = new PictureBox();
                starOne.Size = new Size(25, 26);
                starTwo.Size = new Size(25, 26);
                starThree.Size = new Size(25, 26);
                starFour.Size = new Size(25, 26);
                starFive.Size = new Size(25, 26);

                starOne.Margin = new Padding(3);
                starTwo.Margin = new Padding(3);
                starThree.Margin = new Padding(3);
                starFour.Margin = new Padding(3);
                starFive.Margin = new Padding(3);

                starOne.Padding = new Padding(0);
                starTwo.Padding = new Padding(0);
                starThree.Padding = new Padding(0);
                starFour.Padding = new Padding(0);
                starFive.Padding = new Padding(0);

                starOne.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                starTwo.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                starThree.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                starFour.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");
                starFive.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png");

                stars = new List<PictureBox>();
                stars.Add(starOne);
                stars.Add(starTwo);
                stars.Add(starThree);
                stars.Add(starFour);
                stars.Add(starFive);

                //Event listeners
                ratings.MouseLeave += new EventHandler(ratings_MouseLeave);

                starOne.MouseEnter += new EventHandler(oneStar_MouseEnter);
                starTwo.MouseEnter += new EventHandler(twoStar_MouseEnter);
                starThree.MouseEnter += new EventHandler(threeStar_MouseEnter);
                starFour.MouseEnter += new EventHandler(fourStar_MouseEnter);
                starFive.MouseEnter += new EventHandler(fiveStar_MouseEnter);

                starOne.MouseClick += new MouseEventHandler(starOne_MouseClick);
                starTwo.MouseClick += new MouseEventHandler(starTwo_MouseClick);
                starThree.MouseClick += new MouseEventHandler(starThree_MouseClick);
                starFour.MouseClick += new MouseEventHandler(starFour_MouseClick);
                starFive.MouseClick += new MouseEventHandler(starFive_MouseClick);

                Button btnSkip = new Button();
                btnSkip.MouseClick += new MouseEventHandler(btnSkip_MouseClick);
                btnSkip.Text = "Skip";
                btnSkip.BackColor = Color.LightSkyBlue;
                btnSkip.ForeColor = Color.White;
                btnSkip.Width = 150;
                btnSkip.FlatStyle = FlatStyle.Flat;

                Label lblRatingsLeft = new Label();
                lblRatingsLeft.ForeColor = Color.White;
                lblRatingsLeft.Text = (ratingsDone).ToString() + " ratings to go.";

                //Add to panels
                ratings.Controls.Add(starOne);
                ratings.Controls.Add(starTwo);
                ratings.Controls.Add(starThree);
                ratings.Controls.Add(starFour);
                ratings.Controls.Add(starFive);
                ratings.Controls.Add(btnSkip);

                leftCol.Controls.Add(theMovie.buildThumbnailPanel()); //add thumbnails

                leftCol.Controls.Add(ratings);

                if(ratingsDone != -1)
                    leftCol.Controls.Add(lblRatingsLeft);

                pnlContent.Controls.Add(leftCol);
                //pnlRate.Controls.Add(leftCol);
            }
            else
            {
                pnlContent.Controls.Clear();
                FlowLayoutPanel temp = new FlowLayoutPanel();
                temp.FlowDirection = FlowDirection.TopDown;
                temp.Height = 400;
                temp.Width = 800;
                Label error = new Label();
                error.Height = 150;
                error.Width = 800;
                error.TextAlign = ContentAlignment.BottomCenter;
                error.ForeColor = Color.White;
                error.Text = "Ratings Complete! We can now give you recommendations, if you would like to continue rating movies, click the button below:";
                lblLocation.Text = "Ratings Complete";

                Button moreRatings = new Button();
                moreRatings.Margin = new Padding(350, 20, 0, 0);
                moreRatings.Text = "Continue Rating!";
                moreRatings.AutoSize = true;
                moreRatings.FlatStyle = FlatStyle.Flat;
                moreRatings.ForeColor = Color.White;
                moreRatings.BackColor = Color.LightSkyBlue;

                moreRatings.MouseClick += new MouseEventHandler(moreRatings_MouseClick);

                temp.Controls.Add(error);
                temp.Controls.Add(moreRatings);
                pnlContent.Controls.Add(temp);
            }
        }
Beispiel #6
0
        public MovieInfo(Movie m)
        {
            InitializeComponent();

            this.m = m;
        }
        public void generateFields(Movie m)
        {
            // The Movie Data Has Been Captured. Let's Now Fill The Data Entries
            TitleBox.Text = m.Title;
            YearBox.Text = m.Year.ToString();
            DirectorBox.Text = m.Director;
            TimeBox.Text = m.Length.ToString();
            RatingList.SelectedIndex = m.Rating;

            // Multiple Genres
            // We recieved a list of strings
            foreach (string genre in m.Genres)
            {
                GenreText.Text += (genre + ",");
            }
            GenreText.Text = GenreText.Text.Remove(GenreText.Text.Length - 1);

            // Multiple Actors
            // We recieved a list of strings
            foreach (string actor in m.Actors)
            {
                ActorText.Text += (actor + ",");
            }
            ActorText.Text = ActorText.Text.Remove(ActorText.Text.Length - 1);

            Poster.Load(m.Poster);
            PosterPath.Text = "<Loaded>";
            button1.Text = "Change...";
            Console.WriteLine(m.Owned);
            OwnedCheck.Checked = m.Owned;

            // Enumerate Certifications G PG PG-13 R
            Dictionary<string, int> certs = new Dictionary<string, int>();
            certs.Add("G", 0);
            certs.Add("PG", 1);
            certs.Add("PG-13", 2);
            certs.Add("R", 3);

            if (m.Certification != null)
            {
                RatingSelecter.SelectedIndex = certs[m.Certification];
            }

            if (m.Description != null)
            {
                DescriptionText.Text = m.Description;
            }

            // Now we can re-enable editing:
            foreach (Control ctrl in this.Controls)
            {
                if (ctrl is TextBox)
                    ((TextBox)ctrl).ReadOnly = false;
                else if (ctrl is ComboBox)
                    ((ComboBox)ctrl).Enabled = true;
                else if (ctrl is CheckBox)
                    ((CheckBox)ctrl).Enabled = true;
                else if (ctrl is Button)
                    ((Button)ctrl).Enabled = true;
            }
        }
 private void MovieEditor_DragDrop(object sender, DragEventArgs e)
 {
     m = (Movie)e.Data.GetData(typeof(Movie));
     //  MessageBox.Show(m.Title);
     generateFields(m);
 }
 private void Form8_Load(object sender, EventArgs e)
 {
     RatingSelecter.SelectedIndex = -1;
     m = null;
     this.AllowDrop = true;
     FinalAdder.Text = "Apply Changes";
     foreach (Control ctrl in this.Controls)
     {
         if (ctrl is TextBox)
             ((TextBox)ctrl).ReadOnly = true;
         else if (ctrl is ComboBox)
             ((ComboBox)ctrl).Enabled = false;
         else if (ctrl is CheckBox)
             ((CheckBox)ctrl).Enabled = false;
         else if (ctrl is Button)
             ((Button)ctrl).Enabled = false;
     }
 }
 private void Searcher_Click(object sender, EventArgs e)
 {
     // Run An Exact Text Search for MovieTarget.Text
     result = caller.getMovie(MovieTarget.Text);
     if (result != null)
     {
         TargetPoster.Load(result.Poster); found = true;
     }
     else
     {
         MessageBox.Show("Could not find that movie. Make sure your title is exact.", "Movie Not Found");
     }
 }
Beispiel #11
0
        public Color getColor(Dictionary<string,Color> colorMap,List<string> genres, Movie m)
        {
            if(m.Genres == null)
                MessageBox.Show(m.Title);

            foreach(string u in m.Genres)
            {
                foreach(string v in genres)
                {
                    if(u.Equals(v))
                    {
                        return colorMap[v];
                    }
                }
            }

            return Color.Black;
        }