Пример #1
1
        public MovieItem(Movie movie, MovieManager manager, Form1 form)
        {
            this.form = form;
            this.movie = movie;
            this.Image = movie.image;
            this.SizeMode = PictureBoxSizeMode.Zoom;
            this.BackColor = Color.Black;
            this.MouseDoubleClick += (s, e) =>
            {
                if (Form.ModifierKeys == Keys.Control)
                {
                    System.Diagnostics.ProcessStartInfo ps = new System.Diagnostics.ProcessStartInfo("cmd", string.Format("/c \"{0}\"", "\"C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe\" \"" + movie.location + "\""));
                    System.Diagnostics.Process.Start(ps);
                }
                else
                {
                    new MoviePlayer(movie).Show();
                }
            };
            sBoxImg.Image = Properties.Resources.selectedImg;
            sBoxImg.Size = new System.Drawing.Size(10, 10);
            sBoxImg.Location = new Point(190, 0);
            sBoxImg.Visible = false;
            Controls.Add(sBoxImg);
            this.MouseClick += (s, e) =>
            {
                if (e.Button == System.Windows.Forms.MouseButtons.Right)
                {
                    List<Movie> list = new List<Movie>();
                    list.Add(movie);
                    MovieEdit edit = new MovieEdit(manager, list, form, this);
                    edit.changedImage = false;
                    edit.newMovie = false;
                    edit.ShowDialog();
                    if (edit.changed && edit.changedImage)
                    {
                        Image = movie.image;
                    }
                }
                else if (e.Button == System.Windows.Forms.MouseButtons.Left && Form.ModifierKeys == Keys.Control)
                {
                    if (selectedMovies.Contains(movie))
                    {
                        selectedMovies.Remove(movie);
                        sBoxImg.Visible = false;
                    }
                    else
                    {
                        selectedMovies.Add(movie);
                        sBoxImg.Visible = true;
                    }
                    form.SelectedCountLabel.Text = selectedMovies.Count.ToString();
                    form.SetSelectButtons(selectedMovies.Count != 0);
                }
            };
            this.MouseHover += MovieItem_MouseHover;
            this.MouseLeave += MovieItem_MouseLeave;

            CustomLabel length = new CustomLabel();
            length.Text = (movie.length / 60).ToString() + ":" + (movie.length % 60).ToString("00");
            length.Size = new System.Drawing.Size(this.Size.Width, 14);
            length.BackColor = Color.Transparent;
            length.ForeColor = Color.White;
            length.OutlineForeColor = Color.Black;
            this.Controls.Add(length);

            if (selectedMovies.Contains(movie))
            {
                sBoxImg.Visible = true;
            }
        }
Пример #2
0
 public MoviePlayer(Movie movie)
 {
     InitializeComponent();
     this.Size = Screen.PrimaryScreen.Bounds.Size;
     this.movies = new Queue<Movie>();
     this.movies.Enqueue(movie);
     axVLCPlugin21.Size = this.Size;
     axVLCPlugin21.Visible = true;
     axVLCPlugin21.playlist.add(@"file:///" + movie.location);
     axVLCPlugin21.playlist.play();
     playerController = new PlayerController(axVLCPlugin21);
 }