/// <summary> /// Führt dieses Kommando aus. /// </summary> /// <param name="parameter">Der Parameter für das Kommando. Kann <see langword="null"/> sein.</param> public override void Execute(object parameter) { // Instantiate all movies. int nPl = 0; int offsetY = 0; int vspacing = 20; bool isFirst = true; int maxHeight = 0; List<VideoFile> firstVideos = new List<VideoFile>(); Context.Instance.DestroySync(); this._chains.Clear(); foreach (Playlist pl in Context.Instance.Playlists) { StaticPosition pos = new StaticPosition(0, offsetY); isFirst = true; maxHeight = 0; Chain C = new Chain(); Chain Start = C; this._chains.Add(C); foreach (Movie m in pl.Movies) { VideoFile video = Context.Instance.Player.CreateVideoFromFile(m.Info.FullName); if (video != null) { if (C.For == null) C.For = video; else { Chain C_copy = new Chain(video); C.Next = C_copy; C = C_copy; C_copy.Next = Start; this._chains.Add(C_copy); } video.Visible = false; video.Pause(); Context.Instance.Sync.Add(video); video.LoopCount = 1; video.Movement = pos; video.OnRemove += OnVideoElementRemove; video.OnLoopFinished += OnVideoElementLoopFinished; if (video.Height > maxHeight) maxHeight = (int)video.Height; if (isFirst) { isFirst = false; firstVideos.Add(video); } } } nPl++; offsetY += maxHeight + vspacing; } Context.Instance.Sync.Play(); Context.Instance.Sync.Visible = true; CommandManager.InvalidateRequerySuggested(); }
/// <summary> /// Führt dieses Kommando aus. /// </summary> /// <param name="parameter">Der Parameter für das Kommando. Kann <see langword="null"/> sein.</param> public override void Execute(object parameter) { // Instantiate all movies. int nPl = 0; int nMov = 0; int canvasWidth = Context.Instance.Player.WindowWidth; int canvasHeight = Context.Instance.Player.WindowHeight; uint lb = 1000; int hspacing = 0; int vspacing = 10; int offsetX = 0; int offsetY = 0; Context.Instance.DestroySync(); foreach (Playlist pl in Context.Instance.Playlists) { offsetX = 0; nMov = 0; foreach (Movie m in pl.Movies) { // Neues Video erstellens VideoFile video = Context.Instance.Player.CreateVideoFromFile(m.Info.FullName); if (video != null) { // Erstmal unsichtbar machen bis die Positionierung abgeschlossen ist. video.Visible = false; // Schonmal den 1. Frame laden video.Pause(); // Wir wollen alle Videos gleichzeitig starten! Context.Instance.Sync.Add(video); // Wir wollen jedes Video an einer festen Position. StaticPosition pos = new StaticPosition(0, offsetY); video.Movement = pos; // Positionsbestimmung: video.EndOfLineOverlap = 0; video.OffsetX = offsetX; video.LineBreak = lb; if (offsetX + video.Width > canvasWidth) { offsetX = (int)video.Width - (canvasWidth - offsetX) + hspacing + (canvasWidth - (int)lb); offsetY += (int)video.Height * (int)(canvasWidth / video.Width); } else { offsetX += (int)video.Width + hspacing; } if (nMov == pl.Movies.Count() - 1) offsetY += (int)video.Height; } nMov++; } nPl++; offsetY += vspacing; } // Jetzt alle Videos starten und sichtbar machen Context.Instance.Sync.Play(); Context.Instance.Sync.Visible = true; CommandManager.InvalidateRequerySuggested(); }