private void CheckPlayTime() { var seconds = ViewTimeline.Position.TotalSeconds; Canvas.SetLeft(CurrentTime, seconds); for (var i = Model.MediaTracks.Count - 1; i >= 0; i--) { if (InPatchSection(Model.MediaTracks[i], seconds)) { if (currentPatch == Model.MediaTracks[i]) { return; } currentPatch = Model.MediaTracks[i]; PatchWindow.Source = Model.MediaTracks[i].Path; var shift = currentPatch.LeftShift; var position = seconds - (shift); PatchWindow.Position = TimeSpan.FromSeconds(position); PatchWindow.Play(); ViewTimeline.Volume = 0; ViewTimeline.Visibility = System.Windows.Visibility.Collapsed; return; } } PatchWindow.Pause(); ViewTimeline.Volume = volume; ViewTimeline.Visibility = System.Windows.Visibility.Visible; currentPatch = null; }
private void CheckPlayTime() { if (Model.WindowState.isPlaying) { Model.WindowState.TimeSet += 0.1; } var pixelsRelativeToSeconds = Model.WindowState.TimeSet * Model.Scale; CheckSubtitle(pixelsRelativeToSeconds); for (var i = Model.MediaTracks.Count - 1; i >= 0; i--) { if (InPatchSection(Model.MediaTracks[i], pixelsRelativeToSeconds)) { ViewTimeline.Pause(); Canvas.SetLeft(CurrentTime, Model.WindowState.TimeSet * Model.Scale); if (Model.WindowState.currentPatch == Model.MediaTracks[i]) { return; } Model.WindowState.currentPatch = Model.MediaTracks[i]; PatchWindow.Source = Model.MediaTracks[i].Path; var shift = Model.WindowState.currentPatch.LeftShiftInPixels; var position = pixelsRelativeToSeconds - shift + Model.WindowState.currentPatch.StartPixel; PatchWindow.Position = TimeSpan.FromSeconds(position / Model.Scale); if (Model.WindowState.isPlaying) { PatchWindow.Play(); } ViewTimeline.Volume = 0; ViewTimeline.Visibility = System.Windows.Visibility.Hidden; PatchWindow.Visibility = System.Windows.Visibility.Visible; Canvas.SetLeft(CurrentTime, Model.WindowState.TimeSet * Model.Scale); return; } } PatchWindow.Pause(); if (Model.WindowState.isPlaying) { ViewTimeline.Play(); } PatchWindow.Visibility = System.Windows.Visibility.Collapsed; ViewTimeline.Volume = Model.WindowState.volume; ViewTimeline.Visibility = System.Windows.Visibility.Visible; Model.WindowState.currentPatch = null; Canvas.SetLeft(CurrentTime, Model.WindowState.TimeSet * Model.Scale); }
private void PausedChanged() { if (Model.WindowState.isPlaying) { ViewTimeline.Pause(); PatchWindow.Pause(); Model.WindowState.isPlaying = false; return; } else if (!Model.WindowState.isLoaded) { doInitialLoad(); return; } else { ViewTimeline.Play(); PatchWindow.Play(); Model.WindowState.isPlaying = true; } }
private void addTrack(string path, bool isTutoPatch, int episodeNumber, EditorModel model) { var seconds = Model.WindowState.TimeSet; var track = new MediaTrack(path, Model.ScaleInfo, isTutoPatch); track.ModelHash = model == null ? "" : model.Montage.RawVideoHash; track.EpisodeNumber = episodeNumber; track.LeftShiftInSeconds = seconds; track.TopShift = Top; track.DurationInPixels = 10; Model.PropertyChanged += (s, a) => track.NotifyScaleChanged(); Model.MediaTracks.Add(track); PatchWindow.MediaOpened += SetPatchDuration; PatchWindow.Stop(); PatchWindow.Source = null; PatchWindow.Source = new Uri(path); PatchWindow.Play(); //need to fire event to get duration PatchWindow.Pause(); }
private void addTrack(string path) { var seconds = ViewTimeline.Position.TotalSeconds; var track = new TrackInfo(path); track.LeftShift = seconds; track.TopShift = prevoiusTop; track.DurationInSeconds = 10; Model.MediaTracks.Add(track); PatchWindow.MediaOpened += SetPatchDuration; PatchWindow.Stop(); PatchWindow.Source = null; PatchWindow.Source = new Uri(path); PatchWindow.Play(); //need to fire event to get duration PatchWindow.Pause(); //prevoiusTop += 30; //TimeScroll.Height += trackHeight; //mainwindow.Height += trackHeight; //CurrentTime.Height += trackHeight; }