private void BtnAddVideos_MouseClick(object sender, MouseEventArgs e) { string path = Path.Combine(Base._setsFolder, SetModel.SelectedSet, SetModel.SelectedTopic, "Videos"); OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "All Videos Files |*.dat; *.wmv; *.3g2; *.3gp; *.3gp2; *.3gpp; *.amv; *.asf; *.avi; *.bin; *.cue; *.divx; *.dv; *.flv; *.gxf; *.iso; *.m1v; *.m2v; *.m2t; *.m2ts; *.m4v; " + " *.mkv; *.mov; *.mp2; *.mp2v; *.mp4; *.mp4v; *.mpa; *.mpe; *.mpeg; *.mpeg1; *.mpeg2; *.mpeg4; *.mpg; *.mpv2; *.mts; *.nsv; *.nuv; *.ogg; *.ogm; *.ogv; *.ogx; *.ps; *.rec; *.rm; *.rmvb; *.tod; *.ts; *.tts; *.vob; *.vro; *.webm"; dialog.Multiselect = true; dialog.Title = "Add videos to selected topic"; DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK) { foreach (string f in dialog.FileNames) { string newfile = Path.Combine(path, (Path.GetFileNameWithoutExtension(f) + f.Substring(f.Length - 4))); if (!File.Exists(newfile)) { File.Copy(f, newfile); } //Create thumbnail if it doesn't exist already GenerateThumbnails.CreateSingleThumbnail(Base._setsFolder, SetModel.SelectedSet, SetModel.SelectedTopic, newfile); //Add thumbs to panel AddThumbsToPanel(); } } }
public void AddThumbsToPanel() { _setView.VideoThumbPanel.Controls.Clear(); string[] thumbs = GenerateThumbnails.ReturnThumbnailList(Base._setsFolder, SetModel.SelectedSet, SetModel.SelectedTopic); //Get list of thumbnails that are in the folder. Point loc = new Point(0, 5); int i = 0; foreach (string thumb in thumbs) { PictureBox picture = new PictureBox(); picture.Height = 146; picture.Width = 300; picture.SizeMode = PictureBoxSizeMode.Normal; picture.Image = new Bitmap(thumb); picture.Location = loc; _setView.VideoThumbPanel.Controls.Add(picture); loc.X += 310; picture.Name = i.ToString(); //Play video on mouse click picture.Click += delegate { PlayVideo(Int32.Parse(picture.Name)); }; //Display video name on mouse hover picture.MouseHover += new EventHandler((s, e) => thumbGotFocus(s, e, picture, thumb)); i++; void thumbGotFocus(object sender, EventArgs e, Control pic, string title) { ToolTip tt = new ToolTip(); tt.SetToolTip(picture, title.Remove(0, title.LastIndexOf('\\') + 1).Substring(0, title.Remove(0, title.LastIndexOf('\\') + 1).Length - 4)); } } }