diff -r 10acb6a11a73 -r c031f1132dde client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs --- a/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs Mon Dec 14 17:02:03 2009 +0100 +++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs Wed Dec 16 17:14:38 2009 +0100 @@ -96,6 +96,43 @@ } } + + private VideoSequence _actualVideoSequence; + public VideoSequence ActualVideoSequence + { + get + { + return _actualVideoSequence; + } + set + { + _actualVideoSequence = value; + OnPropertyChanged("ActualVideoSequence"); + } + } + + + public List TimeLine + { + get + { + List _tmp = new List(); + TimeSpan temp = TimeSpan.Zero; + foreach (ObservableCollection Ocvs in ListVideoSequences) + { + foreach (VideoSequence Vs in Ocvs) + { + + Vs.TimerIn = temp; + _tmp.Add(Vs); + temp += Vs.Duration; + + } + } + return _tmp; + } + } + private int _selectedChapter=0; public int SelectedChapter { @@ -109,7 +146,19 @@ OnPropertyChanged("SelectedChapter"); } } - + private VideoViewerVM _videoViewerVM; + public VideoViewerVM ViewModelVideoViewer + { + get + { + return _videoViewerVM; + } + set + { + _videoViewerVM = value; + OnPropertyChanged("ViewModelVideoViewer"); + } + } private double _position; public double Position @@ -121,6 +170,7 @@ set { _position = value; + OnPropertyChanged("Position"); } } @@ -178,6 +228,7 @@ Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler(EditorPartSelected_Executed); Commands.ProductionTimeLine.EditorPartFinished.Executed += new EventHandler(EditorPartFinished_Executed); Commands.ProductionView.ClickAddIndex.Executed += new EventHandler(ClickAddIndex_Executed); + Commands.TimeChange.Executed += new EventHandler(TimeChange_Executed); _listVideoSequences[0].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); _listVideoSequences[1].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); _listVideoSequences[2].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); @@ -196,6 +247,31 @@ _listSegmentIndex[3].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); } + void TimeChange_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) + { + double newValue = ((double)e.Parameter); + if(e.Source == this) + { + if (ActualVideoSequence.TimerIn.TotalMilliseconds > newValue || ActualVideoSequence.TimerOut.TotalMilliseconds < newValue) + { + foreach (VideoSequence Vs in TimeLine) + { + if (Vs.TimerIn.TotalMilliseconds <= newValue && Vs.TimerOut.TotalMilliseconds > newValue) + { + ActualVideoSequence = Vs; + ViewModelVideoViewer.GoTo(TimeSpan.FromMilliseconds(newValue) - Vs.TimerIn +Vs.BeginTrim); + } + } + } + else + { + ViewModelVideoViewer.GoTo(TimeSpan.FromMilliseconds(newValue) - ActualVideoSequence.TimerIn); + } + + + } + } + void ClickAddIndex_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) { if(IsIndexing) @@ -229,6 +305,7 @@ void SelectedVideoSequences_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { + OnPropertyChanged("TotalBookDuration"); Commands.ProductionView.VideoRecordUpdated.Execute(); } @@ -251,5 +328,17 @@ IsIndexing = ((HeaderProductionEventArgs)e.Source).IsIndexPart; } + public event EventHandler SwitchVideo; + + } + public class ProductionTimeLineVMEventArgs : EventArgs + { + public VideoSequence VideoSequence{get;set;} + public TimeSpan BeginAt{get;set;} + public ProductionTimeLineVMEventArgs(VideoSequence videoSequence,TimeSpan beginAt) + { + VideoSequence = videoSequence; + BeginAt = beginAt; + } } }