94 { |
94 { |
95 return _newBook.Chapters[SelectedChapter]; |
95 return _newBook.Chapters[SelectedChapter]; |
96 } |
96 } |
97 } |
97 } |
98 |
98 |
|
99 |
|
100 private VideoSequence _actualVideoSequence; |
|
101 public VideoSequence ActualVideoSequence |
|
102 { |
|
103 get |
|
104 { |
|
105 return _actualVideoSequence; |
|
106 } |
|
107 set |
|
108 { |
|
109 _actualVideoSequence = value; |
|
110 OnPropertyChanged("ActualVideoSequence"); |
|
111 } |
|
112 } |
|
113 |
|
114 |
|
115 public List<VideoSequence> TimeLine |
|
116 { |
|
117 get |
|
118 { |
|
119 List<VideoSequence> _tmp = new List<VideoSequence>(); |
|
120 TimeSpan temp = TimeSpan.Zero; |
|
121 foreach (ObservableCollection<VideoSequence> Ocvs in ListVideoSequences) |
|
122 { |
|
123 foreach (VideoSequence Vs in Ocvs) |
|
124 { |
|
125 |
|
126 Vs.TimerIn = temp; |
|
127 _tmp.Add(Vs); |
|
128 temp += Vs.Duration; |
|
129 |
|
130 } |
|
131 } |
|
132 return _tmp; |
|
133 } |
|
134 } |
|
135 |
99 private int _selectedChapter=0; |
136 private int _selectedChapter=0; |
100 public int SelectedChapter |
137 public int SelectedChapter |
101 { |
138 { |
102 get |
139 get |
103 { |
140 { |
107 { |
144 { |
108 _selectedChapter = value; |
145 _selectedChapter = value; |
109 OnPropertyChanged("SelectedChapter"); |
146 OnPropertyChanged("SelectedChapter"); |
110 } |
147 } |
111 } |
148 } |
112 |
149 private VideoViewerVM _videoViewerVM; |
|
150 public VideoViewerVM ViewModelVideoViewer |
|
151 { |
|
152 get |
|
153 { |
|
154 return _videoViewerVM; |
|
155 } |
|
156 set |
|
157 { |
|
158 _videoViewerVM = value; |
|
159 OnPropertyChanged("ViewModelVideoViewer"); |
|
160 } |
|
161 } |
113 |
162 |
114 private double _position; |
163 private double _position; |
115 public double Position |
164 public double Position |
116 { |
165 { |
117 get |
166 get |
176 // SelectedVideoSequences = new ObservableCollection<VideoSequence>(); |
226 // SelectedVideoSequences = new ObservableCollection<VideoSequence>(); |
177 Commands.ProductionView.DelVideoSequence.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(DelVideoSequence_Executed); |
227 Commands.ProductionView.DelVideoSequence.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(DelVideoSequence_Executed); |
178 Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartSelected_Executed); |
228 Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartSelected_Executed); |
179 Commands.ProductionTimeLine.EditorPartFinished.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartFinished_Executed); |
229 Commands.ProductionTimeLine.EditorPartFinished.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartFinished_Executed); |
180 Commands.ProductionView.ClickAddIndex.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(ClickAddIndex_Executed); |
230 Commands.ProductionView.ClickAddIndex.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(ClickAddIndex_Executed); |
|
231 Commands.TimeChange.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(TimeChange_Executed); |
181 _listVideoSequences[0].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); |
232 _listVideoSequences[0].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); |
182 _listVideoSequences[1].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); |
233 _listVideoSequences[1].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); |
183 _listVideoSequences[2].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); |
234 _listVideoSequences[2].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); |
184 _listVideoSequences[3].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); |
235 _listVideoSequences[3].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); |
185 |
236 |
194 _listSegmentIndex[1].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); |
245 _listSegmentIndex[1].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); |
195 _listSegmentIndex[2].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); |
246 _listSegmentIndex[2].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); |
196 _listSegmentIndex[3].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); |
247 _listSegmentIndex[3].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged); |
197 } |
248 } |
198 |
249 |
|
250 void TimeChange_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
|
251 { |
|
252 double newValue = ((double)e.Parameter); |
|
253 if(e.Source == this) |
|
254 { |
|
255 if (ActualVideoSequence.TimerIn.TotalMilliseconds > newValue || ActualVideoSequence.TimerOut.TotalMilliseconds < newValue) |
|
256 { |
|
257 foreach (VideoSequence Vs in TimeLine) |
|
258 { |
|
259 if (Vs.TimerIn.TotalMilliseconds <= newValue && Vs.TimerOut.TotalMilliseconds > newValue) |
|
260 { |
|
261 ActualVideoSequence = Vs; |
|
262 ViewModelVideoViewer.GoTo(TimeSpan.FromMilliseconds(newValue) - Vs.TimerIn +Vs.BeginTrim); |
|
263 } |
|
264 } |
|
265 } |
|
266 else |
|
267 { |
|
268 ViewModelVideoViewer.GoTo(TimeSpan.FromMilliseconds(newValue) - ActualVideoSequence.TimerIn); |
|
269 } |
|
270 |
|
271 |
|
272 } |
|
273 } |
|
274 |
199 void ClickAddIndex_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
275 void ClickAddIndex_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
200 { |
276 { |
201 if(IsIndexing) |
277 if(IsIndexing) |
202 { |
278 { |
203 TimeSpan dur = TimeSpan.Zero; |
279 TimeSpan dur = TimeSpan.Zero; |
227 OnPropertyChanged("TotalBookDuration"); |
303 OnPropertyChanged("TotalBookDuration"); |
228 } |
304 } |
229 |
305 |
230 void SelectedVideoSequences_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) |
306 void SelectedVideoSequences_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) |
231 { |
307 { |
|
308 |
232 OnPropertyChanged("TotalBookDuration"); |
309 OnPropertyChanged("TotalBookDuration"); |
233 Commands.ProductionView.VideoRecordUpdated.Execute(); |
310 Commands.ProductionView.VideoRecordUpdated.Execute(); |
234 } |
311 } |
235 |
312 |
236 void ProductionTimeLineVM_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) |
313 void ProductionTimeLineVM_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) |
249 SelectedChapter = (int)((HeaderProductionEventArgs)e.Source).ChapterType; |
326 SelectedChapter = (int)((HeaderProductionEventArgs)e.Source).ChapterType; |
250 SelectedChapterType = ((HeaderProductionEventArgs)e.Source).ChapterType ; |
327 SelectedChapterType = ((HeaderProductionEventArgs)e.Source).ChapterType ; |
251 IsIndexing = ((HeaderProductionEventArgs)e.Source).IsIndexPart; |
328 IsIndexing = ((HeaderProductionEventArgs)e.Source).IsIndexPart; |
252 } |
329 } |
253 |
330 |
|
331 public event EventHandler<ProductionTimeLineVMEventArgs> SwitchVideo; |
|
332 |
|
333 } |
|
334 public class ProductionTimeLineVMEventArgs : EventArgs |
|
335 { |
|
336 public VideoSequence VideoSequence{get;set;} |
|
337 public TimeSpan BeginAt{get;set;} |
|
338 public ProductionTimeLineVMEventArgs(VideoSequence videoSequence,TimeSpan beginAt) |
|
339 { |
|
340 VideoSequence = videoSequence; |
|
341 BeginAt = beginAt; |
|
342 } |
254 } |
343 } |
255 } |
344 } |