/// <summary> /// Constructeur /// </summary> public Tapes() { Disque = @"H:"; nouvelles = new List <Videos>(); nsh = new List <Shots>(); if (!Directory.Exists(Disque)) { FolderBrowserDialog fdb = new FolderBrowserDialog(); fdb.Description = "Sélectionnez le disque"; if (fdb.ShowDialog() == DialogResult.OK) { BasePath = BasePath.Replace(Disque, fdb.SelectedPath); Disque = fdb.SelectedPath; } else { return; } } md = new Modèle(); InitializeComponent(); cutDelay = 2; time.Interval = 1000; time.Tick += Time_Tick; frameTimer.Tick += FrameTimer_Tick; int frtotal = md.Shots.Sum(s => s.FrameCount).Value; global.Text = Videos.DuréeShot(frtotal); sceneIndexControl.Init(md); dataSelector.Init(md); shotsToPlay = new List <Shots>(); }
public void SetScene(Scenes sc) { currentScene = sc; listPersons.Items.Clear(); SceneTitle.Text = currentScene.Titre; comment.Text = currentScene.Commentaire; if (sc.Lieux != null) { cBPays.SelectedItem = sc.Lieux.Villes.Pays; cBPays.Text = sc.Lieux.Villes.Pays.Nom_Pays; cBVille.Text = sc.Lieux.Villes.Nom; cBLieu.Text = sc.Lieux.Lieu; cBVille.SelectedItem = sc.Lieux.Villes; cBLieu.SelectedItem = sc.Lieux; } else { cBPays.SelectedItem = md.Pays.Single(p => p.Nom_Pays == "France"); cBVille.Text = ""; cBLieu.Text = ""; UpDateVilles((Pays)cBPays.SelectedItem); } ShotNumber.Text = currentScene.SequenceScene.Count.ToString(); Duration.Text = Videos.DuréeShot(currentScene.FrameCount); keywordList.Items.Clear(); foreach (var x in currentScene.KeywordScene) { AddKeywordToListView(x.Keywords); } if (currentScene.PrésenceScène != null) { foreach (var p in currentScene.PrésenceScène) { AddPersonToListView(p.Personnes); } } Valid.Enabled = true; }
private void DisplayPanel_Paint(object sender, PaintEventArgs e) { if ((scenes == null) || (scenes.Count == 0)) { return; } int x = 0; int y = 0; int largeur = (int)(scenes[0].Videos.Largeur * ImageZoomFactor) / Facteur; int hauteur = (int)(scenes[0].Videos.Hauteur * ImageZoomFactor) / Facteur; size = 6; int fontSize = (int)(size * ImageZoomFactor); int interval = (int)(2 * size * ImageZoomFactor); Font f = new Font("Times New Roman", fontSize); imagesPerRow = Math.Max(1, Width / largeur); scrollPictures.Maximum = scenes.Count; scrollPictures.Value = startImage / imagesPerRow; x = 0; y = 0; //Scenes s = scenes.FirstOrDefault(m => m.Selected); //if (s != null) // startImage = scenes.IndexOf(s); for (int i = startImage; i < scenes.Count; i++) { try { #region Show image Data scrollPictures.Value = startImage; Scenes scene = scenes[i]; if (scene.Selected) { Pen p = new Pen(new SolidBrush(Color.Red), 3); e.Graphics.DrawRectangle(p, new Rectangle(x, y, largeur, hauteur)); } if (scene.Image != null) { MemoryStream mi = new MemoryStream(scene.Image); Image imi = Image.FromStream(mi); e.Graphics.DrawImage(imi, new Rectangle(x, y, largeur, hauteur)); imi.Dispose(); GC.Collect(); } else { if (scene.SequenceScene.Count > 0) { MemoryStream mi = new MemoryStream(scene.SequenceScene.First().Shots.Image); Image imi = Image.FromStream(mi); e.Graphics.DrawImage(imi, new Rectangle(x, y, largeur, hauteur)); imi.Dispose(); GC.Collect(); } } Détails = true; List <string> textes = new List <string> { scene.FrameCount.ToString() + " Frames soit " + Videos.DuréeShot((int)scene.FrameCount), scene.Titre + " ", scene.Lieux?.Villes.Nom + " " + scene.Lieux?.Lieu }; string deb = scene.SequenceScene.FirstOrDefault().Shots.DateShot.Value.ToShortDateString(); if (scene.SequenceScene.First().Shots.Fichier.Contains("Clip")) { string s = Path.GetFileNameWithoutExtension(scene.SequenceScene.First().Shots.Fichier); int ind = s.IndexOf("Clip ") + 4; s = s.Substring(ind, s.Length - ind); string ll = Path.GetFileNameWithoutExtension(scene.SequenceScene.Last().Shots.Fichier); ind = ll.IndexOf("Clip ") + 4; ll = ll.Substring(ind, ll.Length - ind); textes.Add(deb + " " + scene.SequenceScene.Count.ToString() + " clips " + s + "-" + ll); } else { string s = Path.GetFileNameWithoutExtension(scene.SequenceScene.First().Shots.Fichier); string ll = Path.GetFileNameWithoutExtension(scene.SequenceScene.Last().Shots.Fichier); textes.Add(deb + " " + scene.SequenceScene.Count.ToString() + " clips " + s + "-" + ll); } nombreLignes = 0;; if (Détails) { foreach (string s in textes) { e.Graphics.DrawString(s, f, Brushes.Black, new Point(x, y + hauteur + nombreLignes * interval)); nombreLignes++; } } x += largeur; if (x > Width - largeur) { x = 0; y += hauteur; if (Détails) { y += nombreLignes * interval; } } #endregion if (y > Height) { return; } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } } }
private void DisplayPanel_Paint(object sender, PaintEventArgs e) { if (media == null) { return; } int x = 0; int y = 0; int w = (int)(media[0].Largeur * ImageZoomFactor) / Facteur; int h = (int)(media[0].Hauteur * ImageZoomFactor) / Facteur; int fontSize = (int)(size * ImageZoomFactor); int interval = (int)(2 * size * ImageZoomFactor); Font f = new Font("Times New Roman", fontSize); imagesPerRow = Math.Max(1, Width / w); scrollPictures.Maximum = 10; scrollPictures.Maximum = media.Count; scrollPictures.Value = startImage / imagesPerRow; x = 0; y = 0; Shots s = media.FirstOrDefault(m => m.Selected); if (s != null) { startImage = media.IndexOf(s); } for (int i = startImage; i < media.Count; i++) { try { #region Show image Data scrollPictures.Value = startImage; Shots clip = media[i]; if (clip.Selected) { Pen p = new Pen(new SolidBrush(Color.Red), 3); e.Graphics.DrawRectangle(p, new Rectangle(x, y, w, h)); } if (clip.Image != null) { MemoryStream mi = new MemoryStream(clip.Image); Image imi = Image.FromStream(mi); e.Graphics.DrawImage(imi, new Rectangle(x, y, w, h)); imi.Dispose(); } //else //{ // string d = Path.GetDirectoryName(clip.FichierImage); // int ix = d.LastIndexOf(@"\"); // string c = d.Substring(ix); // string fi = Path.GetFileNameWithoutExtension(clip.FichierImage); // Image im = Image.FromFile(@"E:\VideoThumbs\" + c + "\\" + fi + ".jpg"); // e.Graphics.DrawImage(im, x, y, w, h); // e.Graphics.DrawRectangle(Pens.Red, x, y, w, h); //} if (Détails) { List <String> textes = new List <string>(); string longueur = Videos.DuréeShot((int)clip.FrameCount); textes.Add(clip.DateShot?.ToLongDateString() + " " + clip.DateShot?.ToLongTimeString()); textes.Add(clip.FrameCount.ToString() + " Frames soit " + longueur); textes.Add("Tape " + clip.Code_Bande.ToString() + " Shot : " + Path.GetFileNameWithoutExtension(clip.Fichier)); textes.Add(clip.Commentaire + " " + clip.Lieux?.Lieu); if (clip.Largeur == 1980) { size = 14; } e.Graphics.DrawString(clip.DateShot?.ToLongDateString() + " " + clip.DateShot?.ToLongTimeString(), f, Brushes.Black, new Point(x, y + h)); e.Graphics.DrawString(clip.FrameCount.ToString() + " Frames soit " + longueur, f, Brushes.Black, new Point(x, y + h + interval)); e.Graphics.DrawString("Tape " + clip.Code_Bande.ToString() + " Shot : " + Path.GetFileNameWithoutExtension(clip.Fichier), f, Brushes.Black, new Point(x, y + h + 2 * interval)); e.Graphics.DrawString(clip.Commentaire + " " + clip.Lieux?.Lieu, f, Brushes.Black, new Point(x, y + h + 3 * interval)); } x += w + 10; if (x > Width - w) { x = 0; y += h; if (Détails) { y += 4 * interval; } } #endregion if (y > Height) { return; } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } } }