Update ProductionView
authorMatthieu Totet
Mon, 07 Dec 2009 10:36:55 +0100
changeset 18 66911d0f0eb6
parent 17 0e4e63f6f567
child 19 7d044e7562ea
Update ProductionView
client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs
client/src/Iri.Modernisation.Controls/Converter/PolemicTypeColorConverter.cs
client/src/Iri.Modernisation.Controls/View/BookTimeLine/BookTimeLine.xaml
client/src/Iri.Modernisation.Controls/View/BookTimeLine/BookTimeLine.xaml.cs
client/src/Iri.Modernisation.Controls/View/HeaderProduction/HeaderProduction.xaml.cs
client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs
client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml.cs
client/src/Iri.Modernisation.Controls/ViewModel/NavigationBar/ChutierVM.cs
client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs
client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs
client/src/Iri.Modernisation.Data/Models/VideoBook.cs
client/src/Iri.Modernisation.Data/Models/VideoChapter.cs
client/test/mainInterface/Iri.Modernisation.Test.MainInterface/MainPage.xaml.cs
--- a/client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs	Thu Dec 03 16:05:57 2009 +0100
+++ b/client/src/Iri.Modernisation.BaseMVVM/Commands/Commands.cs	Mon Dec 07 10:36:55 2009 +0100
@@ -375,12 +375,18 @@
             static  ProductionTimeLine()
             {
                 EditorPartSelected = new Command("EditorPartSelected");
+                EditorPartFinished = new Command("EditorPartFinished");
             }
             public static Command EditorPartSelected
             {
                 get;
                 private set;
             }
+            public static Command EditorPartFinished
+            {
+                get;
+                private set;
+            }
             static public void Initialize()
             { }
         }
--- a/client/src/Iri.Modernisation.Controls/Converter/PolemicTypeColorConverter.cs	Thu Dec 03 16:05:57 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/Converter/PolemicTypeColorConverter.cs	Mon Dec 07 10:36:55 2009 +0100
@@ -54,11 +54,11 @@
                 VideoChapterType dt = (VideoChapterType)value;
                 switch (dt)
                 {
-                    case VideoChapterType.Modernite:
-                        returnBrush = new SolidColorBrush(new Color() { A = 255, R = 0xD6, G = 0xA3, B = 0x82 });
+                    case VideoChapterType.Modernite: 
+                        returnBrush = new SolidColorBrush(new Color() { A = 255, R = 0xBF, G = 0xA8, B = 0x4E });
                         break;
-                    case VideoChapterType.Modernisation:
-                        returnBrush = new SolidColorBrush(new Color() { A = 255, R = 0xBF, G = 0xA8, B = 0x4E });
+                    case VideoChapterType.Modernisation: 
+                        returnBrush = new SolidColorBrush(new Color() { A = 255, R = 0xD6, G = 0xA3, B = 0x82 });
                         break;
                     case VideoChapterType.Postmodernite:
                         returnBrush = new SolidColorBrush(new Color() { A = 255, R = 0xB5, G = 0xCB, B = 0x29 });
--- a/client/src/Iri.Modernisation.Controls/View/BookTimeLine/BookTimeLine.xaml	Thu Dec 03 16:05:57 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/BookTimeLine/BookTimeLine.xaml	Mon Dec 07 10:36:55 2009 +0100
@@ -20,11 +20,12 @@
 			<ToggleButton x:Name="DisplayCommentButton"  Content="Display" Width="88" IsChecked="True"/>
 			<Slider x:Name="ScaleTimeLine" Height="31" HorizontalAlignment="Left" Margin="143,0,1,0"  Width="138" Value="600" Minimum="600" Maximum="10000" />
 		</StackPanel>
-		<ScrollViewer x:Name="TimeLineScroller"  HorizontalScrollBarVisibility="Visible" Height="233" Margin="0,0,8,0" VerticalScrollBarVisibility="Disabled" >
+		<ScrollViewer x:Name="TimeLineScroller"  HorizontalScrollBarVisibility="Visible" Margin="0,0,8,0" VerticalScrollBarVisibility="Disabled" >
 			<StackPanel x:Name="TimeStripsPanel" Width="{Binding Value, ElementName=ScaleTimeLine, Mode=OneWay}" RenderTransformOrigin="0,0.5">
 				
 				<Slider x:Name="BookTimeLineSlider" Canvas.ZIndex="10" Height="31"  d:LayoutOverrides="Height" Maximum="{Binding TotalDuration}" Value="{Binding Position,Mode=TwoWay}" MouseLeftButtonDown="BookTimeLineSlider_MouseLeftButtonDown" />
-				<Canvas x:Name="BookTimeLineElementPanel" Visibility="{Binding IsChecked, Converter={StaticResource BoolToVisibility}, ElementName=DisplayCommentButton, Mode=OneWay}" />
+				<Canvas x:Name="BookTimeLineElementPanel" />
+				<Canvas x:Name="BookTimeLineAnnotationPanel" Visibility="{Binding IsChecked, Converter={StaticResource BoolToVisibility}, ElementName=DisplayCommentButton, Mode=OneWay}" Margin="0,12,0,0" />
 				<StackPanel Margin="0,80,0,0">
 				<!--	<TestSpectrogramme:Spectrogramme ColorBar="Red" x:Name="PolemicSpec" Height="20" Canvas.ZIndex="-2"/>
 					<TestSpectrogramme:Spectrogramme ColorBar="#00FF00" x:Name="AdhesionSpec" Height="20" Canvas.ZIndex="-2"/>
--- a/client/src/Iri.Modernisation.Controls/View/BookTimeLine/BookTimeLine.xaml.cs	Thu Dec 03 16:05:57 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/BookTimeLine/BookTimeLine.xaml.cs	Mon Dec 07 10:36:55 2009 +0100
@@ -35,6 +35,7 @@
         {
             BookTimeLineVM VM = (BookTimeLineVM)DataContext;
             BookTimeLineElementPanel.Children.Clear();
+            BookTimeLineAnnotationPanel.Children.Clear();
             foreach (List<SegmentIndex> LIndex in VM.SegmentIndex)
             {
                 foreach (SegmentIndex Index in LIndex)
@@ -45,6 +46,7 @@
                     pol.SetValue(Canvas.ZIndexProperty, 10);
                     pol.DataContext = new PolemicElementVM(Index);
                     BookTimeLineElementPanel.Children.Add(pol);
+                  
                     Canvas.SetLeft(pol, (Index.TimerIn.TotalMilliseconds * ScaleTimeLine.Value) / VM.TotalDuration);
                     pol.Width = (Index.Duration.TotalMilliseconds * ScaleTimeLine.Value) / VM.TotalDuration;
                 }
@@ -57,7 +59,7 @@
                     PolemicElementControl pol = new PolemicElementControl();
                     pol.SetValue(Canvas.ZIndexProperty, 10);
                     pol.DataContext = new PolemicElementVM(Annotation);
-                    BookTimeLineElementPanel.Children.Add(pol);
+                    BookTimeLineAnnotationPanel.Children.Add(pol);
                     Canvas.SetLeft(pol, (Annotation.TimerIn.TotalMilliseconds * ScaleTimeLine.Value) / VM.TotalDuration);
                     Canvas.SetTop(pol, basi);
                     basi += 10;
--- a/client/src/Iri.Modernisation.Controls/View/HeaderProduction/HeaderProduction.xaml.cs	Thu Dec 03 16:05:57 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/HeaderProduction/HeaderProduction.xaml.cs	Mon Dec 07 10:36:55 2009 +0100
@@ -133,22 +133,39 @@
         void OuvertureIndexController_HeaderProductionPartFinished(object sender, HeaderProductionPartControlerEventArgs e)
         {
             Commands.HeaderProduction.Chap04IndexingOkClick.Execute();
+            if (FinishedPart != null)
+            {
+                FinishedPart(sender,new HeaderProductionEventArgs());
+            }
+
         }
 
         void PostModerniteIndexController_HeaderProductionPartFinished(object sender, HeaderProductionPartControlerEventArgs e)
         {
             Commands.HeaderProduction.Chap03IndexingOkClick.Execute();
+            if (FinishedPart != null)
+            {
+                FinishedPart(sender, new HeaderProductionEventArgs());
+            }
         }
 
         void ModerniteIndexController_HeaderProductionPartFinished(object sender, HeaderProductionPartControlerEventArgs e)
         {
             Commands.HeaderProduction.Chap02IndexingOkClick.Execute();
+            if (FinishedPart != null)
+            {
+                FinishedPart(sender, new HeaderProductionEventArgs());
+            }
         }
 
         void OuvertureEditionController_HeaderProductionPartFinished(object sender, HeaderProductionPartControlerEventArgs e)
         {
             Commands.HeaderProduction.Chap04EditingOkClick.Execute();
             OuvertureIndexController.Active();
+            if (FinishedPart != null)
+            {
+                FinishedPart(sender, new HeaderProductionEventArgs());
+            }
         }
 
         void PostModerniteEditionController_HeaderProductionPartFinished(object sender, HeaderProductionPartControlerEventArgs e)
@@ -156,6 +173,10 @@
             Commands.HeaderProduction.Chap03EditingOkClick.Execute();
             PostModerniteIndexController.Active();
             OuvertureEditionController.Active();
+            if (FinishedPart != null)
+            {
+                FinishedPart(sender, new HeaderProductionEventArgs());
+            }
         }
 
         void ModerniteEditionControler_HeaderProductionPartFinished(object sender, HeaderProductionPartControlerEventArgs e)
@@ -164,11 +185,19 @@
             Commands.HeaderProduction.Chap02EditingOkClick.Execute();
             ModerniteIndexController.Active();
             PostModerniteEditionController.Active();
+            if (FinishedPart != null)
+            {
+                FinishedPart(sender, new HeaderProductionEventArgs());
+            }
         }
 
         void ModernisationIndexControl_HeaderProductionPartFinished(object sender, HeaderProductionPartControlerEventArgs e)
         {
             Commands.HeaderProduction.Chap01IndexingOkClick.Execute();
+            if (FinishedPart != null)
+            {
+                FinishedPart(sender, new HeaderProductionEventArgs());
+            }
         }
 
         void HeaderProductionPartSelected(object sender, HeaderProductionPartControlerEventArgs e)
@@ -192,16 +221,23 @@
             Commands.HeaderProduction.Chap01EditingOkClick.Execute();
             ModernisationIndexController.Active();
 			ModerniteEditionController.Active();
+            if (FinishedPart != null)
+            {
+                FinishedPart(sender, new HeaderProductionEventArgs());
+            }
            
         }
         public event EventHandler<HeaderProductionEventArgs> SelectedPart;
-        
+        public event EventHandler<HeaderProductionEventArgs> FinishedPart;
 
 	}
     public class HeaderProductionEventArgs : EventArgs
     {
         public VideoChapterType ChapterType;
         public bool IsIndexPart;
+        public HeaderProductionEventArgs()
+        {
+        }
         public HeaderProductionEventArgs(VideoChapterType chapterType,bool isIndexpPrt)
         {
             ChapterType = chapterType;
--- a/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs	Thu Dec 03 16:05:57 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionTimeLine/ProductionTimeLine.xaml.cs	Mon Dec 07 10:36:55 2009 +0100
@@ -39,41 +39,45 @@
         private void AddSequenceButton_Click(object sender, System.Windows.RoutedEventArgs e)
         {
             Random rndNumbers = new Random();
-            if(!((ProductionTimeLineVM)DataContext).IsIndexing)
+            if (((ProductionTimeLineVM)this.DataContext).SelectedChapter != -1)
             {
+                if(!((ProductionTimeLineVM)DataContext).IsIndexing)
+                {
 
-            CustomableVideoElement _temp = new CustomableVideoElement()
-                                     {
-                                         DataContext = new CustomableVideoElementVM(new VideoSequence()
+                CustomableVideoElement _temp = new CustomableVideoElement()
                                          {
+                                             DataContext = new CustomableVideoElementVM(new VideoSequence()
+                                             {
 
-                                             RunTime = new TimeSpan(0, rndNumbers.Next(10, 60), 0),
-                                             BeginTrim = new TimeSpan(0, 0, 0),
-                                             EndTrim = new TimeSpan(0, 0, 0),
+                                                 RunTime = new TimeSpan(0, rndNumbers.Next(10, 60), 0),
+                                                 BeginTrim = new TimeSpan(0, 0, 0),
+                                                 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);
-            
-               VideoTimeStrip.Children.Add(_temp  );// TODO: Add event handler implementation here.
-            }
-            else
-            {
-                VideoChapter vc = ((ProductionTimeLineVM)DataContext).SelectedBookChapter;
-                PolemicElementControl an = new PolemicElementControl()
+                                             }) { 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);
+                
+                   VideoTimeStrip.Children.Add(_temp  );// TODO: Add event handler implementation here.
+                }
+                else
                 {
-                    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);
+                    VideoChapter vc = ((ProductionTimeLineVM)DataContext).SelectedBookChapter;
+                    PolemicElementControl an = new PolemicElementControl();
+                    an.DataContext = new PolemicElementVM(new SegmentIndex(vc)
+                        {
+                            TimerIn = TimeSpan.Zero,
+                            Duration = new TimeSpan(0, rndNumbers.Next(10, 60), 0),
+                            Chapter = vc,
+
+                        });
+                    
+                        //((ProductionTimeLineVM)DataContext).SelectedBookChapter);
+                    AnnotationTimeStrip.Children.Add(an);
+                }
             }
         }
 
--- a/client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml.cs	Thu Dec 03 16:05:57 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ProductionView/ProductionView.xaml.cs	Mon Dec 07 10:36:55 2009 +0100
@@ -19,6 +19,7 @@
             Commands.Initialize();
             InitializeComponent();
             HeaderProductionElement.SelectedPart += Commands.ProductionTimeLine.EditorPartSelected.Execute;
+            HeaderProductionElement.FinishedPart += Commands.ProductionTimeLine.EditorPartFinished.Execute;
             //HeaderProductionElement.SelectedPart += new EventHandler<HeaderProductionEventArgs>(HeaderProductionElement_SelectedPart);
         }
 
--- a/client/src/Iri.Modernisation.Controls/ViewModel/NavigationBar/ChutierVM.cs	Thu Dec 03 16:05:57 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/NavigationBar/ChutierVM.cs	Mon Dec 07 10:36:55 2009 +0100
@@ -129,9 +129,9 @@
         }
         void RefChutierAdd_Executed(object sender, ExecutedEventArgs e)
         {
-             if(!_annotations.Contains((PolemicElement)e.Parameter))
+             if(!Annotations.Contains((PolemicElement)e.Parameter))
              {
-                  _annotations.Add((PolemicElement)e.Parameter);
+                  Annotations.Add((PolemicElement)e.Parameter);
              }
              else
              {
--- a/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs	Thu Dec 03 16:05:57 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionTimeLine/ProductionTimeLineVM.cs	Mon Dec 07 10:36:55 2009 +0100
@@ -118,11 +118,19 @@
             
             
             Commands.ProductionTimeLine.EditorPartSelected.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartSelected_Executed);
-       
+            Commands.ProductionTimeLine.EditorPartFinished.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(EditorPartFinished_Executed);
             }
 
+        void EditorPartFinished_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
+        {
+            SelectedChapter = -1;
+     
+        }
+
         void EditorPartSelected_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
         {
+           
+            SelectedChapter = (int)((HeaderProductionEventArgs)e.Source).ChapterType;
             SelectedChapterType = ((HeaderProductionEventArgs)e.Source).ChapterType ;
             IsIndexing = ((HeaderProductionEventArgs)e.Source).IsIndexPart;
         }
--- a/client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs	Thu Dec 03 16:05:57 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/ProductionView/ProductionViewVM.cs	Mon Dec 07 10:36:55 2009 +0100
@@ -10,6 +10,7 @@
 using System.Windows.Shapes;
 using Iri.Modernisation.BaseMVVM.Commands;
 using Iri.Modernisation.BaseMVVM.ViewModel;
+using Iri.Modernisation.Controls.View;
 namespace Iri.Modernisation.Controls.ViewModel
 {
     public class ProductionViewVM : BaseMVVM.ViewModel.ViewModel
@@ -40,11 +41,14 @@
                 OnPropertyChanged("ViewModelProductionTimeLine");
             }
         }
-
+        //SelectedChapter
         public ProductionViewVM()
         {
             ViewModelHeaderProduction = new HeaderProductionVM();
             ViewModelProductionTimeLine = new ProductionTimeLineVM();
+           
         }
+
+       
     }
 }
--- a/client/src/Iri.Modernisation.Data/Models/VideoBook.cs	Thu Dec 03 16:05:57 2009 +0100
+++ b/client/src/Iri.Modernisation.Data/Models/VideoBook.cs	Mon Dec 07 10:36:55 2009 +0100
@@ -47,8 +47,8 @@
         public VideoBook()
         {
             Chapters = new VideoChapter[4];
-            Chapters[0] = new VideoChapter(this,"Modernisation",VideoChapterType.Modernite);
-            Chapters[1] = new VideoChapter(this, "Modernité", VideoChapterType.Modernisation);
+            Chapters[0] = new VideoChapter(this, "Modernisation", VideoChapterType.Modernisation);
+            Chapters[1] = new VideoChapter(this, "Modernité", VideoChapterType.Modernite);
             Chapters[2] = new VideoChapter(this, "Post-Modernité",VideoChapterType.Postmodernite);
             Chapters[3] = new VideoChapter(this, "Ouverture",VideoChapterType.Ouverture);
          
--- a/client/src/Iri.Modernisation.Data/Models/VideoChapter.cs	Thu Dec 03 16:05:57 2009 +0100
+++ b/client/src/Iri.Modernisation.Data/Models/VideoChapter.cs	Mon Dec 07 10:36:55 2009 +0100
@@ -13,10 +13,10 @@
 {
     public enum VideoChapterType
     {
-        Modernite=0,
-        Modernisation=1,
-        Postmodernite,
-        Ouverture
+        Modernisation = 0,
+        Modernite=1,
+        Postmodernite=2,
+        Ouverture=3
     }
 
     /// <summary>
--- a/client/test/mainInterface/Iri.Modernisation.Test.MainInterface/MainPage.xaml.cs	Thu Dec 03 16:05:57 2009 +0100
+++ b/client/test/mainInterface/Iri.Modernisation.Test.MainInterface/MainPage.xaml.cs	Mon Dec 07 10:36:55 2009 +0100
@@ -48,8 +48,8 @@
             /********************************************/
 
             /*************** Initialisation des commandes ***************/
-         
-           // Commands.FlipView.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(FlipView_Executed);
+            
+            // Commands.FlipView.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(FlipView_Executed);
             /********************************************/
             MainElement.DataContext = new MainVM(SelectedVideoBooks);
             /*************** Initialisation des Component **************