client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs
changeset 17 0e4e63f6f567
parent 0 249d70e7b32d
child 18 66911d0f0eb6
--- a/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs	Thu Dec 03 16:05:43 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs	Thu Dec 03 16:05:57 2009 +0100
@@ -26,6 +26,7 @@
 		{
 			// Required to initialize variables
 			InitializeComponent();
+          
             Commands.Action.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(Action_Executed);
           
 		}
@@ -38,23 +39,42 @@
         private void AddSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e)
         {
             Random rndNumbers = new Random();
-       
+            if(!((ProductionTimeLineVM)DataContext).IsIndexing)
+            {
 
             CustomableVideoElement _temp = new CustomableVideoElement()
                                      {
                                          DataContext = new CustomableVideoElementVM(new VideoSequence()
                                          {
 
-                                             RunTime = new TimeSpan(0, rndNumbers.Next(10,60), 0),
+                                             RunTime = new TimeSpan(0, rndNumbers.Next(10, 60), 0),
                                              BeginTrim = new TimeSpan(0, 0, 0),
-                                             EndTrim = new TimeSpan(0, 0, 0)
-                                         }),
-                                       // Width = 200
+                                             EndTrim = new TimeSpan(0, 0, 0),
+
+                                         }) { Chapter = ((ProductionTimeLineVM)this.DataContext).SelectedChapterType},
+                                         // Width = 200
                                      };
+            
             _temp.MouseMove += new MouseEventHandler(CustomableVideoElement_MouseMove);
             _temp.MouseLeftButtonDown += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonDown);
             _temp.MouseLeftButtonUp += new MouseButtonEventHandler(CustomableVideoElement_MouseLeftButtonUp);
-            TimeStrip.Children.Add(_temp  );// TODO: Add event handler implementation here.
+            
+               VideoTimeStrip.Children.Add(_temp  );// TODO: Add event handler implementation here.
+            }
+            else
+            {
+                VideoChapter vc = ((ProductionTimeLineVM)DataContext).SelectedBookChapter;
+                PolemicElementControl an = new PolemicElementControl()
+                {
+                    DataContext = new PolemicElementVM(new SegmentIndex(vc))
+                    {
+                        TimerIn = TimeSpan.Zero,
+                        Duration = new TimeSpan(0, rndNumbers.Next(10, 60), 0)
+                    },
+                };
+                    //((ProductionTimeLineVM)DataContext).SelectedBookChapter);
+                AnnotationTimeStrip.Children.Add(an);
+            }
         }
 
         
@@ -75,7 +95,7 @@
         void CustomableVideoElement_MouseMove(object sender, MouseEventArgs e)
         {
 
-            _selected = ((CustomableVideoElement)sender);
+            
             if (_isTrimRightCapturated && ((CustomableVideoElement)sender).CaptureMouse())
             {
                 ((CustomableVideoElement)sender).TrimRight = _comePoint.X  - e.GetPosition(((CustomableVideoElement)sender)).X;
@@ -96,6 +116,7 @@
 
         void CustomableVideoElement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
         {
+            _selected = ((CustomableVideoElement)sender);
             if (e.GetPosition(((CustomableVideoElement)sender)).X >= ((CustomableVideoElement)sender).Width - 5)
             {
                 _comePoint = e.GetPosition(((CustomableVideoElement)sender));
@@ -110,7 +131,7 @@
 
         private void DeleteSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e)
         {
-            TimeStrip.Children.Remove(_selected);
+            VideoTimeStrip.Children.Remove(_selected);
         }
 	}
 }
\ No newline at end of file