Update PolemicElement View : Can Display Correct Color of VideoChapter
authorMatthieu Totet
Mon, 23 Nov 2009 17:05:00 +0100
changeset 10 12515e11b357
parent 9 185e3ab53a56
child 11 94595c0c8242
Update PolemicElement View : Can Display Correct Color of VideoChapter
client/src/Iri.Modernisation.Controls/Converter/PolemicTypeColorConverter.cs
client/src/Iri.Modernisation.Controls/Iri.Modernisation.Controls.csproj
client/src/Iri.Modernisation.Controls/ViewModel/PolemicElementVM.cs
client/src/Iri.Modernisation.Data/ClassDiagram1.cd
client/src/Iri.Modernisation.Data/Ldt/Readers.cs
client/src/Iri.Modernisation.Data/Models/PolemicElement.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.Controls/Converter/PolemicTypeColorConverter.cs	Mon Nov 23 14:52:34 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/Converter/PolemicTypeColorConverter.cs	Mon Nov 23 17:05:00 2009 +0100
@@ -16,35 +16,63 @@
     {
         public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
         {
-            return Convert((PolemicElementType)value);
+            return Convert(value);
 
         }
-        public static Brush Convert(PolemicElementType value)
+        public static Brush Convert(object value)
         {
-            PolemicElementType dt = (PolemicElementType)value;
-            SolidColorBrush returnBrush;
-            switch (dt)
+            SolidColorBrush returnBrush = new SolidColorBrush(new Color() { A = 255, R = 255, G = 255, B = 255 });
+            if (value is PolemicElementType)
             {
-                case PolemicElementType.Basic:
-                    returnBrush = new SolidColorBrush(new Color() { A = 255, R = 255, G = 255, B = 255 });
-                    break;
-                case PolemicElementType.Polemic:
-                    returnBrush = new SolidColorBrush(new Color() { A = 255, R = 255, G = 0, B = 0 });
-                    break;
-                case PolemicElementType.Adhesion:
-                    returnBrush = new  SolidColorBrush(new Color() { A = 255, R = 0, G = 255, B = 0 });
-                    break;
-                case PolemicElementType.Reference:
-                    returnBrush = new  SolidColorBrush(new Color() { A = 255, R = 0, G = 0, B = 255 });
-                    break;
-                case PolemicElementType.Question:
-                    returnBrush = new  SolidColorBrush(new Color() { A = 255, R = 255, G = 255, B = 0 });
-                    break;
-                default:
-                    returnBrush = new  SolidColorBrush(new Color() { A = 255, R = 255, G = 255, B = 255 });
-                    break;
+                PolemicElementType dt = (PolemicElementType)value;
+                
+                switch (dt)
+                {
+                    case PolemicElementType.Basic:
+                        returnBrush = new SolidColorBrush(new Color() { A = 255, R = 255, G = 255, B = 255 });
+                        break;
+                    case PolemicElementType.Polemic:
+                        returnBrush = new SolidColorBrush(new Color() { A = 255, R = 255, G = 0, B = 0 });
+                        break;
+                    case PolemicElementType.Adhesion:
+                        returnBrush = new  SolidColorBrush(new Color() { A = 255, R = 0, G = 255, B = 0 });
+                        break;
+                    case PolemicElementType.Reference:
+                        returnBrush = new  SolidColorBrush(new Color() { A = 255, R = 0, G = 0, B = 255 });
+                        break;
+                    case PolemicElementType.Question:
+                        returnBrush = new  SolidColorBrush(new Color() { A = 255, R = 255, G = 255, B = 0 });
+                        break;
+                    default:
+                        returnBrush = new  SolidColorBrush(new Color() { A = 255, R = 255, G = 255, B = 255 });
+                        break;
+                }
+               
             }
-            return returnBrush;
+            else if(value is VideoChapterType)
+            {
+                VideoChapterType dt = (VideoChapterType)value;
+                switch (dt)
+                {
+                    case VideoChapterType.Modernite:
+                        returnBrush = new SolidColorBrush(new Color() { A = 255, R = 0xD6, G = 0xA3, B = 0x82 });
+                        break;
+                    case VideoChapterType.Modernisation:
+                        returnBrush = new SolidColorBrush(new Color() { A = 255, R = 0xBF, G = 0xA8, B = 0x4E });
+                        break;
+                    case VideoChapterType.Postmodernite:
+                        returnBrush = new SolidColorBrush(new Color() { A = 255, R = 0xB5, G = 0xCB, B = 0x29 });
+                        break;
+                    case VideoChapterType.Ouverture:
+                        returnBrush = new SolidColorBrush(new Color() { A = 255, R = 0x5B, G = 0xCC, B = 0x5B });
+                        break;
+                    default:
+                        break;
+                }
+
+            }
+           
+             return returnBrush;
         }
         public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
         {
@@ -52,5 +80,19 @@
             throw new NotImplementedException();
 
         }
+        /*
+          case VideoChapterType.Modernite:
+                    returnBrush = new SolidColorBrush(new Color() { A = 255, R = 0xD6, G = 0xA3, B = 0x82 });
+                    break;
+                case VideoChapterType.Modernisation:
+                    returnBrush = new SolidColorBrush(new Color() { A = 255, R = 0xBF, G = 0xA8, B = 0x4E});
+                    break;
+                case VideoChapterType.Postmodernite:
+                    returnBrush = new SolidColorBrush(new Color() { A = 255, R = 0xB5, G = 0xCB, B = 0x29 });
+                    break;
+                case VideoChapterType.Ouverture:
+                    returnBrush = new SolidColorBrush(new Color() { A = 255, R = 0x5B, G = 0xCC, B = 0x5B });
+                    break;
+         */
     }
 }
--- a/client/src/Iri.Modernisation.Controls/Iri.Modernisation.Controls.csproj	Mon Nov 23 14:52:34 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/Iri.Modernisation.Controls.csproj	Mon Nov 23 17:05:00 2009 +0100
@@ -79,7 +79,7 @@
     <Compile Include="ViewModel\MenuableViewModel.cs" />
     <Compile Include="ViewModel\NavigationBar\NavigationBarVM.cs" />
     <Compile Include="ViewModel\PolemicElementVM.cs" />
-    <Compile Include="ViewModel\NavigationBar\ProductionMenuVM.cs" />
+    <Compile Include="ViewModel\ProductionTimeLine\ProductionMenuVM.cs" />
     <Compile Include="ViewModel\ProductionTimeLine\CustomableVideoElementVM.cs" />
     <Compile Include="ViewModel\ProductionTimeLine\ProductionTimeLineVM.cs" />
     <Compile Include="ViewModel\VideoViewer\VideoViewerVM.cs" />
--- a/client/src/Iri.Modernisation.Controls/ViewModel/PolemicElementVM.cs	Mon Nov 23 14:52:34 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/PolemicElementVM.cs	Mon Nov 23 17:05:00 2009 +0100
@@ -188,7 +188,7 @@
         /// <summary>
         /// PolemicType de l'élément
         /// </summary>
-        public PolemicElementType Type
+        public object Type
         {
             get
             {
@@ -196,6 +196,10 @@
                 {
                     return ((Annotation)_element).Type;
                 }
+                else if(_element is SegmentIndex)
+                {
+                    return ((SegmentIndex)_element).Chapter.Type;
+                }
                 else
                 {
                     return PolemicElementType.Basic;
--- a/client/src/Iri.Modernisation.Data/ClassDiagram1.cd	Mon Nov 23 14:52:34 2009 +0100
+++ b/client/src/Iri.Modernisation.Data/ClassDiagram1.cd	Mon Nov 23 17:05:00 2009 +0100
@@ -71,8 +71,8 @@
     <AssociationLine Name="Chapters" Type="Iri.Modernisation.Data.Models.VideoChapter" FixedFromPoint="true" FixedToPoint="true">
       <Path>
         <Point X="3.25" Y="7.25" />
-        <Point X="3.25" Y="5.5" />
-        <Point X="2.25" Y="5.5" />
+        <Point X="3.25" Y="5.651" />
+        <Point X="2.25" Y="5.651" />
       </Path>
     </AssociationLine>
     <TypeIdentifier>
@@ -89,7 +89,7 @@
   <Class Name="Iri.Modernisation.Data.Models.VideoChapter">
     <Position X="0.75" Y="4.25" Width="1.5" />
     <TypeIdentifier>
-      <HashCode>AAAAAAAAAEAAAEBAAAAAAAAAQAAAAAAAAAEAAAAAAAA=</HashCode>
+      <HashCode>AAAAAAAAAEAAAEBAAAAAAAAAQAAAAAAAAQEAAAAAAAA=</HashCode>
       <FileName>Models\VideoChapter.cs</FileName>
     </TypeIdentifier>
     <ShowAsAssociation>
--- a/client/src/Iri.Modernisation.Data/Ldt/Readers.cs	Mon Nov 23 14:52:34 2009 +0100
+++ b/client/src/Iri.Modernisation.Data/Ldt/Readers.cs	Mon Nov 23 17:05:00 2009 +0100
@@ -55,16 +55,32 @@
                 // Initialisation des index
                 foreach (LDTAnnotationsContent LDTAC in _ldtFile.Annotations)
                 {
+                    int count=0;
+                    int decoupage = LDTAC.Content[2].Elements.Count/4;
+                    int selectedChapter = 0;
                     foreach(LDTElement LDTE  in LDTAC.Content[2].Elements)
                     {
-                        _videoBook.Chapters[0].Index.Add(new SegmentIndex(_videoBook.Chapters[0])
+                       
+                       
+                        _videoBook.Chapters[selectedChapter].Index.Add(new SegmentIndex(_videoBook.Chapters[selectedChapter])
                         {
                             Title = LDTE.Title,
                             Description = LDTE.Abstract,
                             Tags = LDTE.Tags,
                             TimerIn = new TimeSpan(0, 0, 0, 0, (int)LDTE.Begin),
                             Duration = new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur),
+                            
                         });
+                        count++;
+                        if (count % decoupage == 0)
+                        {
+                            selectedChapter++;
+                            if (selectedChapter >= 4)
+                            {
+                                selectedChapter = 3;
+                            }
+                        }
+                        
                        _videoBook.Duration =  _videoBook.Duration.Add(new TimeSpan(0, 0, 0, 0, (int)LDTE.Dur));
                     }
                     foreach (LDTElement LDTE in LDTAC.Content[3].Elements)
--- a/client/src/Iri.Modernisation.Data/Models/PolemicElement.cs	Mon Nov 23 14:52:34 2009 +0100
+++ b/client/src/Iri.Modernisation.Data/Models/PolemicElement.cs	Mon Nov 23 17:05:00 2009 +0100
@@ -21,7 +21,8 @@
         Polemic=1,
         Adhesion,
         Reference,
-        Question
+        Question 
+      
     };
 
     /// <summary>
--- a/client/src/Iri.Modernisation.Data/Models/VideoBook.cs	Mon Nov 23 14:52:34 2009 +0100
+++ b/client/src/Iri.Modernisation.Data/Models/VideoBook.cs	Mon Nov 23 17:05:00 2009 +0100
@@ -47,10 +47,10 @@
         public VideoBook()
         {
             Chapters = new VideoChapter[4];
-            Chapters[0] = new VideoChapter(this,"Modernisation");
-            Chapters[1] = new VideoChapter(this, "Modernité");
-            Chapters[2] = new VideoChapter(this, "Post-Modernité");
-            Chapters[3] = new VideoChapter(this, "Ouverture");
+            Chapters[0] = new VideoChapter(this,"Modernisation",VideoChapterType.Modernite);
+            Chapters[1] = new VideoChapter(this, "Modernité", VideoChapterType.Modernisation);
+            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	Mon Nov 23 14:52:34 2009 +0100
+++ b/client/src/Iri.Modernisation.Data/Models/VideoChapter.cs	Mon Nov 23 17:05:00 2009 +0100
@@ -11,6 +11,14 @@
 using System.Collections.Generic;
 namespace Iri.Modernisation.Data.Models
 {
+    public enum VideoChapterType
+    {
+        Modernite=0,
+        Modernisation=1,
+        Postmodernite,
+        Ouverture
+    }
+
     /// <summary>
     /// Chapitre d'un VideoLivre
     /// </summary>
@@ -22,6 +30,11 @@
         public VideoBook Book {get;set;}
 
         /// <summary>
+        /// Chapitre
+        /// </summary>
+        public VideoChapterType Type { get; set; }
+
+        /// <summary>
         /// Titre du chapitre
         /// </summary>
         public String Title { get; set; }
@@ -45,9 +58,10 @@
         /// Constructeur
         /// </summary>
         /// <param name="name">Nom du chaptire</param>
-        public VideoChapter(VideoBook fromBook,String name)
+        public VideoChapter(VideoBook fromBook,String name,VideoChapterType type)
         {
             Book = fromBook;
+            Type = type;
             Title = name;
             Index = new List<SegmentIndex>();
             Annotations = new List<Annotation>();
--- a/client/test/mainInterface/Iri.Modernisation.Test.MainInterface/MainPage.xaml.cs	Mon Nov 23 14:52:34 2009 +0100
+++ b/client/test/mainInterface/Iri.Modernisation.Test.MainInterface/MainPage.xaml.cs	Mon Nov 23 17:05:00 2009 +0100
@@ -43,7 +43,7 @@
             temp.MediaPath = Application.Current.Host.Source.Host+@"/video.mp4";
             SelectedVideoBooks.Add(temp);
             SelectedVideoBooks.Add(new LDTFileReader("Content/ENMI08-III_elizabethrosse-psychologie_et_reseaux_sociaux-jauffret.ldt").VideoBook);
-            SelectedVideoBooks.Add(new LDTFileReader("Content/ENMI08-IV-dominiquepasquier-jauffret.ldt").VideoBook);
+           // SelectedVideoBooks.Add(new LDTFileReader("Content/ENMI08-IV-dominiquepasquier-jauffret.ldt").VideoBook);
             /********************************************/
 
             /*************** Initialisation des commandes ***************/