client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs
--- a/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs Tue Dec 08 11:39:27 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs Fri Dec 11 10:48:58 2009 +0100
@@ -13,7 +13,8 @@
using Iri.Modernisation.BaseMVVM.ViewModel;
using Iri.Modernisation.Controls.View;
using System.Collections.Generic;
-using SLExtensions.Collections.ObjectModel;
+using System.Collections.ObjectModel;
+
namespace Iri.Modernisation.Controls.ViewModel
{
public class ProductionTimeLineVM : BaseMVVM.ViewModel.ViewModel
@@ -95,10 +96,17 @@
}
}
-
-
- private List<SegmentIndex>[] _listSegmentIndex = new List<SegmentIndex>[4];
- public List<SegmentIndex> SelectedIndex
+
+
+ private ObservableCollection<SegmentIndex>[] _listSegmentIndex;
+ public ObservableCollection<SegmentIndex>[] ListIndex
+ {
+ get
+ {
+ return _listSegmentIndex;
+ }
+ }
+ public ObservableCollection<SegmentIndex> SelectedIndex
{
get
{
@@ -107,7 +115,7 @@
set
{
_listSegmentIndex[SelectedChapter] = value;
- _newBook.Chapters[SelectedChapter].Index = value;
+ //_newBook.Chapters[SelectedChapter].Index = value;
OnPropertyChanged("SelectedIndex");
}
}
@@ -139,13 +147,55 @@
};
// PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ProductionTimeLineVM_PropertyChanged);
// SelectedVideoSequences = new ObservableCollection<VideoSequence>();
+ Commands.ProductionView.DelVideoSequence.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(DelVideoSequence_Executed);
Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartSelected_Executed);
Commands.ProductionTimeLine.EditorPartFinished.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartFinished_Executed);
+ Commands.ProductionView.ClickAddIndex.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(ClickAddIndex_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);
_listVideoSequences[3].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
-
+
+ _listSegmentIndex = new ObservableCollection<SegmentIndex>[4]
+ {
+ new ObservableCollection<SegmentIndex>(),
+ new ObservableCollection<SegmentIndex>(),
+ new ObservableCollection<SegmentIndex>(),
+ new ObservableCollection<SegmentIndex>()
+ };
+ _listSegmentIndex[0].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
+ _listSegmentIndex[1].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
+ _listSegmentIndex[2].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
+ _listSegmentIndex[3].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
+ }
+
+ void ClickAddIndex_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+ {
+ if(IsIndexing)
+ {
+ TimeSpan dur = TimeSpan.Zero;
+ // Permet de créer un Index avec une durée calé sur les videos.
+ foreach (VideoSequence Vs in SelectedVideoSequences)
+ {
+ dur += Vs.Duration;
+ }
+ foreach (SegmentIndex Si in SelectedIndex)
+ {
+ dur -= Si.Duration;
+ }
+ SelectedIndex.Add(new SegmentIndex(SelectedBookChapter)
+ {
+ TimerIn = TimeSpan.Zero,
+ TimerOut = dur,
+ Chapter = SelectedBookChapter
+ });
+ }
+
+ }
+
+ void DelVideoSequence_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+ {
+ SelectedVideoSequences.Remove(((CustomableVideoElementVM)e.Parameter).VideoSequence);
}
void SelectedVideoSequences_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
@@ -155,7 +205,7 @@
void ProductionTimeLineVM_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
- Commands.ProductionView.VideoRecordUpdated.Execute();
+ //Commands.ProductionView.VideoRecordUpdated.Execute();
}
void EditorPartFinished_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)