client/src/Iri.Modernisation.Data/Models/FactoryVideoLivre.cs
changeset 30 644e3cd48034
parent 28 2d4ec5ab2a40
child 32 36302cc9688d
--- a/client/src/Iri.Modernisation.Data/Models/FactoryVideoLivre.cs	Fri Jan 08 11:33:24 2010 +0100
+++ b/client/src/Iri.Modernisation.Data/Models/FactoryVideoLivre.cs	Thu Jan 14 16:39:50 2010 +0100
@@ -33,15 +33,16 @@
 	    }
         static public void Initialize()
         {
-            LoadXMLFile();
+          //  LoadXMLFile();
         }
-        static private void LoadXMLFile()
+        public static void LoadXMLFile(String path)
         {
 
             
             
             xmlClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(XMLFileLoaded);
-            xmlClient.DownloadStringAsync(new Uri("ProjectConfig.xml",UriKind.Relative));
+            Uri uri = new Uri(path, UriKind.RelativeOrAbsolute);
+            xmlClient.DownloadStringAsync(uri);
           
             
         }
@@ -54,23 +55,33 @@
             
                 _configDoc = XDocument.Parse(e.Result);
                 List<VideoChapterDescription> temp = new List<VideoChapterDescription>();
+                List<PolemicTypeDescription> temp_an = new List<PolemicTypeDescription>();
                 int nb = 0;
                 foreach (XElement XChapter in _configDoc.Root.Element("VideoBook").Elements())
                 {
                     temp.Add(new VideoChapterDescription(nb, XChapter.Attribute("name").Value, XChapter.Attribute("color").Value));
                     nb++;
                 }
-                MessageBox.Show(nb.ToString());
+                foreach (XElement XAnnotation in _configDoc.Root.Element("PolemicTypes").Elements())
+                {
+                    temp_an.Add(new PolemicTypeDescription(XAnnotation.Attribute("name").Value, XAnnotation.Attribute("color").Value));
+                }
+             
                 VideoChapterDescriptions = temp.ToArray();
+                AnnotationDescriptions = temp_an.ToArray();
+                FactoryReady(null, new EventArgs());
             }
             else
             {
-                //MessageBox.Show(e.Error.Message);
+                MessageBox.Show(e.Error.Message);
             }
+            
 
         }
+        public static event EventHandler FactoryReady;
        static public void Load(string path)
        {
+         
            _configDoc = XDocument.Load(path);
            List<VideoChapterDescription> temp_vl = new List<VideoChapterDescription>();