client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs
changeset 19 7d044e7562ea
parent 18 66911d0f0eb6
child 20 c2dd8119a6c1
--- a/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs	Mon Dec 07 10:36:55 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs	Tue Dec 08 11:39:27 2009 +0100
@@ -10,6 +10,7 @@
 using Iri.Modernisation.BaseMVVM.Commands;
 using Iri.Modernisation.Data.Models;
 using Iri.Modernisation.Controls.ViewModel;
+using SLExtensions.Collections.ObjectModel;
 namespace Iri.Modernisation.Controls.View
 {
   
@@ -26,16 +27,50 @@
 		{
 			// Required to initialize variables
 			InitializeComponent();
-          
-            Commands.Action.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(Action_Executed);
+            Commands.ProductionView.VideoRecordUpdated.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(VideoRecordUpdated_Executed);
+             Commands.Action.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(Action_Executed);
           
 		}
 
+        void VideoRecordUpdated_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+        {
+          UpdateElements();
+        }
+     
+
         void Action_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
         {
             AddSequenceButton.Content = ((MouseEventArgs)e.Parameter).GetPosition(this).X;
         }
+        public void UpdateElements()
+        {
+            if (DataContext != null)
+            {
+                VideoTimeStrip.Children.Clear();
+                int intChapter = 0;
+                foreach(ObservableCollection<VideoSequence> Ocvs in  ((ProductionTimeLineVM)this.DataContext).ListVideoSequences)
+                {
+                    foreach (VideoSequence Vs in Ocvs)
+                    {
+                        CustomableVideoElement _temp = new CustomableVideoElement()
+                        {
+                            DataContext = new CustomableVideoElementVM(Vs)
+                            {
+                                Chapter = (VideoChapterType)intChapter
+                            },
+                        };
+                        _temp.MouseMove += new MouseEventHandler(CustomableVideoElement_MouseMove);
+                        _temp.MouseLeftButtonDown += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonDown);
+                        _temp.MouseLeftButtonUp += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonUp);
 
+                        VideoTimeStrip.Children.Add(_temp);// TODO: Add event handler implementation here.
+
+                    }
+                    intChapter++;
+                }
+                
+            }
+        }
         private void AddSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e)
         {
             Random rndNumbers = new Random();