client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs
changeset 25 a9c815025a1b
parent 24 c031f1132dde
child 27 f292db96b050
--- a/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs	Wed Dec 16 17:14:38 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs	Fri Dec 18 16:45:30 2009 +0100
@@ -17,11 +17,17 @@
 
 namespace Iri.Modernisation.Controls.ViewModel
 {
+    /// <summary>
+    /// ViewModel de la ProductionTimeLine
+    /// </summary>
     public class ProductionTimeLineVM : BaseMVVM.ViewModel.ViewModel
     {
 
-
         private bool _isIndexing;
+       
+        /// <summary>
+        /// Mode Indexation
+        /// </summary>
         public bool IsIndexing
         {
             get
@@ -37,6 +43,10 @@
 
         private VideoBook _newBook;
         private ObservableCollection<VideoSequence>[] _listVideoSequences = new ObservableCollection<VideoSequence>[4];
+       
+        /// <summary>
+        /// Ensembles des VideoSequences par Chapitre
+        /// </summary>
         public ObservableCollection<VideoSequence>[] ListVideoSequences
         {
             get
@@ -50,6 +60,9 @@
             }
         }
         
+        /// <summary>
+        /// VideoSequences du Chapitre en cours
+        /// </summary>
         public ObservableCollection<VideoSequence> SelectedVideoSequences
         {
             get
@@ -64,6 +77,10 @@
                 OnPropertyChanged("SelectedVideoSequences");
             }
         }
+
+        /// <summary>
+        /// Durée Total du livre
+        /// </summary>
         public TimeSpan TotalBookDuration
         {
             get
@@ -79,6 +96,10 @@
                 return temp;
             }
         }
+
+        /// <summary>
+        /// Chapitres
+        /// </summary>
         public VideoChapter[] Chapters
         {
             get
@@ -88,6 +109,10 @@
           
         
         }
+
+        /// <summary>
+        /// Chapites Courant
+        /// </summary>
         public VideoChapter SelectedBookChapter
         {
             get
@@ -98,6 +123,9 @@
 
 
         private VideoSequence _actualVideoSequence;
+        /// <summary>
+        /// VideoSequence en lecture sur le Master
+        /// </summary>
         public VideoSequence ActualVideoSequence
         {
             get
@@ -111,7 +139,9 @@
             }
         }
 
-     
+        /// <summary>
+        /// Ensemble des VideoSequences 
+        /// </summary>
         public List<VideoSequence> TimeLine
         {
             get
@@ -146,7 +176,11 @@
                 OnPropertyChanged("SelectedChapter");
             }
         }
+
         private VideoViewerVM _videoViewerVM;
+        /// <summary>
+        /// ViewModel du Master
+        /// </summary>
         public VideoViewerVM ViewModelVideoViewer
         {
             get
@@ -161,6 +195,9 @@
         }
 
         private double _position;
+        /// <summary>
+        /// Position Actuelle de lecture
+        /// </summary>
         public double Position
         {
             get
@@ -176,6 +213,9 @@
         }
 
         private ObservableCollection<SegmentIndex>[] _listSegmentIndex;
+        /// <summary>
+        /// Ensemble des Index par Chapitre
+        /// </summary>
         public ObservableCollection<SegmentIndex>[] ListIndex
         {
             get
@@ -183,6 +223,9 @@
                 return _listSegmentIndex;
             }
         }
+        /// <summary>
+        /// Index du Chapitre en cours
+        /// </summary>
         public ObservableCollection<SegmentIndex> SelectedIndex
         {
             get
@@ -198,6 +241,10 @@
         }
 
         private VideoChapterType _selectedChapterType;
+
+        /// <summary>
+        /// Chapitre en cours
+        /// </summary>
         public VideoChapterType SelectedChapterType
         {
             get
@@ -210,8 +257,31 @@
                 OnPropertyChanged("SelectedChapterType");
             }
         }
- 
-      
+
+        private void InitializeCommands()
+        {
+            #region Commands
+            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);
+            Commands.TimeChange.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(TimeChange_Executed);
+            #endregion
+
+            #region VideoSequences CollectionChanged
+            _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);
+            #endregion
+
+            #region SegmentIndex CollectionChanged
+            _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);
+            #endregion
+        }
         public ProductionTimeLineVM()
         {
             _newBook = new VideoBook();
@@ -222,18 +292,6 @@
                 new ObservableCollection<VideoSequence>(),
                 new ObservableCollection<VideoSequence>()
             };
-           // 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);
-            Commands.TimeChange.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(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);
-            _listVideoSequences[3].CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(SelectedVideoSequences_CollectionChanged);
-
             _listSegmentIndex = new ObservableCollection<SegmentIndex>[4]
             {
                 new ObservableCollection<SegmentIndex>(),
@@ -241,13 +299,13 @@
                 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);
+           // PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ProductionTimeLineVM_PropertyChanged);
+           // SelectedVideoSequences = new ObservableCollection<VideoSequence>();
+           InitializeCommands();
         }
 
-        void TimeChange_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+    
+        private void TimeChange_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
         {
             double newValue = ((double)e.Parameter);
             if(e.Source == this)
@@ -259,6 +317,7 @@
                         if (Vs.TimerIn.TotalMilliseconds <= newValue && Vs.TimerOut.TotalMilliseconds > newValue)
                         {
                             ActualVideoSequence = Vs;
+                            ViewModelVideoViewer.Source = ActualVideoSequence.Path;
                             ViewModelVideoViewer.GoTo(TimeSpan.FromMilliseconds(newValue) - Vs.TimerIn +Vs.BeginTrim);
                         }
                     }
@@ -272,7 +331,7 @@
             }
         }
 
-        void ClickAddIndex_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+        private void ClickAddIndex_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
         {
             if(IsIndexing)
             {
@@ -297,30 +356,25 @@
  
         }
 
-        void DelVideoSequence_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+        private void DelVideoSequence_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
         {
             SelectedVideoSequences.Remove(((CustomableVideoElementVM)e.Parameter).VideoSequence);
             OnPropertyChanged("TotalBookDuration");
         }
 
-        void SelectedVideoSequences_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
+        private void SelectedVideoSequences_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
         {
             
             OnPropertyChanged("TotalBookDuration");
             Commands.ProductionView.VideoRecordUpdated.Execute();
         }
 
-        void ProductionTimeLineVM_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
-        {
-            //Commands.ProductionView.VideoRecordUpdated.Execute();
-        }
-
-        void EditorPartFinished_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+        private void EditorPartFinished_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
         {
             SelectedChapter = -1;
         }
 
-        void EditorPartSelected_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+        private void EditorPartSelected_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
         {
            
             SelectedChapter = (int)((HeaderProductionEventArgs)e.Source).ChapterType;