client/src/Iri.Modernisation.Data/Models/SettingsProject.cs
changeset 36 b6df6fce6e5d
parent 35 43bb1b8ed555
child 39 0f2bde8fdfeb
--- a/client/src/Iri.Modernisation.Data/Models/SettingsProject.cs	Mon Jan 25 09:30:22 2010 +0100
+++ b/client/src/Iri.Modernisation.Data/Models/SettingsProject.cs	Wed Jan 27 10:37:39 2010 +0100
@@ -12,6 +12,8 @@
 using System.Threading;
 namespace Iri.Modernisation.Data.Models
 {
+
+    
     /// <summary>
     /// 
     /// </summary>
@@ -19,12 +21,21 @@
     {
         
         
+        
+
         static public List<VideoBook> ListVideoBook { get; set; }
-
+        static public List<VideoSequence> ProductionVideo { get; set; }
+        static public Sync Synchronizer { get; set; }
         static SettingsProject()
         {
-            //_internalDictionary.Add(new Loader<List<VideoBook>>(VideoBook.GetListVideoBook), 
-           //     new KeyValuePair<string, object>("", null));
+            Synchronizer = new Sync();
+            Synchronizer.Completed += new EventHandler<EventArgs>(Synchronizer_Completed);
+        }
+
+        static void Synchronizer_Completed(object sender, EventArgs e)
+        {
+            if (SettingsLoaded != null)
+                SettingsLoaded(sender, e);
         }
         /// <summary>
         /// (Télé)Chargement des données;
@@ -39,7 +50,7 @@
         }
 
         /// <summary>
-        /// 
+        /// Une fois que le fichier config du projet est chargé
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
@@ -47,20 +58,34 @@
         {
             
             Loader<List<VideoBook>> loaderListVideoBook = new Loader<List<VideoBook>>(VideoBook.GetListVideoBook);
-            loaderListVideoBook.LoaderFinished += new EventHandler<LoaderEventArgs<List<VideoBook>>>(LoaderVideoBook_LoaderFinished);
-            loaderListVideoBook.Load(FactoryVideoLivre.VideoBookListPath); 
-           // VideoBookLoaderHelper LoaderVideoBook = new VideoBookLoaderHelper(FactoryVideoLivre.VideoBookListPath);
-           // LoaderVideoBook.LoaderFinished += new EventHandler<LoaderEventArgs<List<VideoBook>>>(LoaderVideoBook_LoaderFinished);
+            
+            loaderListVideoBook.LoaderFinished += new EventHandler<EventArgs>(LoaderVideoBook_LoaderFinished);
+            Synchronizer.RegisterLoader(loaderListVideoBook);
+            
+
+            Loader<List<VideoSequence>> loaderProductionVideo = new Loader<List<VideoSequence>>(VideoSequence.GetProductionVideo);
           
+            loaderProductionVideo.LoaderFinished += new EventHandler<EventArgs>(loaderProductionVideo_LoaderFinished);
+            Synchronizer.RegisterLoader(loaderProductionVideo);
+            
+            loaderProductionVideo.Load(FactoryVideoLivre.ProductionVideoPath);
+            loaderListVideoBook.Load(FactoryVideoLivre.VideoBookListPath);
+
+          
+        }
+
+        static void loaderProductionVideo_LoaderFinished(object sender, EventArgs e)
+        {
+            SettingsProject.ProductionVideo = ((LoaderEventArgs<List<VideoSequence>>)e).CreatedObject;
+    
         }
 
        
 
-        static void LoaderVideoBook_LoaderFinished(object sender, LoaderEventArgs<List<VideoBook>> e)
+        static void LoaderVideoBook_LoaderFinished(object sender, EventArgs e)
         {
-            SettingsProject.ListVideoBook = e.CreatedObject;
-            if (SettingsLoaded != null)
-                SettingsLoaded(sender, e);
+            SettingsProject.ListVideoBook = ((LoaderEventArgs<List<VideoBook>>)e).CreatedObject;
+           
         }
         /// <summary>
         /// Evenement prévenant quand tout est pret