client/src/Iri.Modernisation.Controls/ViewModel/AnnotationMaker/AnnotationMakerVM.cs
changeset 39 0f2bde8fdfeb
parent 38 bd33267300aa
child 42 594fdedecf7f
--- a/client/src/Iri.Modernisation.Controls/ViewModel/AnnotationMaker/AnnotationMakerVM.cs	Thu Feb 04 16:38:04 2010 +0100
+++ b/client/src/Iri.Modernisation.Controls/ViewModel/AnnotationMaker/AnnotationMakerVM.cs	Tue Feb 09 15:30:46 2010 +0100
@@ -15,8 +15,8 @@
 using System.Collections.Generic;
 using System.Linq;
 using Iri.Modernisation.Controls.View;
+using System.IO;
 using Iri.Modernisation.Data.LDTClass;
-
 namespace Iri.Modernisation.Controls.ViewModel
 {
 
@@ -322,6 +322,14 @@
         {
             _newAnnotation.Type = _selectedType ;
             _basicRelation.ToElement = _newAnnotation;
+            _basicRelation.Type = _newAnnotation.Type;
+            _refElement.Chapter.Annotations.Add(_newAnnotation);
+            _refElement.Chapter.Book.BasicLinks.Add(_basicRelation);
+            if(_polemicRelation.ToElement != null)
+            {
+                _refElement.Chapter.Book.PolemicLinks.Add(_polemicRelation);
+            }
+
             LDTElement newAnnotation = new LDTElement(_newAnnotation);
             
            /* 
@@ -335,6 +343,7 @@
             
             LDTFile newfile = new LDTFile()
             {
+               
                 Medias  = new List<LDTMedia>()
                 {
                     new LDTMedia()
@@ -342,7 +351,7 @@
                         Src = _refElement.Chapter.Book.IriPath
                     }
                 },
-                Relations = new List<LDTRelation>()
+                BasicRelations = new List<LDTRelation>()
                 {
                     new LDTRelation()
                     {
@@ -351,6 +360,7 @@
                         //Title = _basicRelation.Title
                     }
                 },
+
                 Annotations = new List<LDTAnnotationsContent>()
                 {
                     new LDTAnnotationsContent()
@@ -377,18 +387,31 @@
                     IdElementTo = _polemicRelation.ToElement.Id,
                     Title = _polemicRelation.Title
                 };
-                newfile.Relations.Add(polemicRelation);
+                newfile.BasicRelations.Add(polemicRelation);
             }
+
+
             //MessageBox.Show(newfile.ToString());
-           
-            /** HttpSend For Web Mode **/
-           /* Application app = Application.Current as Application;
-            HttpSender helper = new HttpSender(new Uri("http://mtotet.free.fr/TestHttpSender/index.php"), "POST",
-                new KeyValuePair<string, string>("authKey", "123456" ),
-                new KeyValuePair<string, string>("newAnnotation", newfile.ToString()),
-                new KeyValuePair<string, string>("msg", "303"));
+
+            /* HttpSend For Web Mode */
+            Application app = Application.Current as Application;
+            HttpSender helper = new HttpSender(new Uri(FactoryVideoLivre.UpdateBookService, UriKind.RelativeOrAbsolute), "POST",
+                new KeyValuePair<string, string>("newAnnotation",System.Windows.Browser.HttpUtility.UrlEncode(
+                                                                    System.Windows.Browser.HttpUtility.HtmlEncode(
+                                                                        _refElement.Chapter.Book.GetLDTFile().ToString())
+                                                    )),
+                new KeyValuePair<String,String>("ldtFileURI",_refElement.Chapter.Book.LdtPath));
             helper.ResponseComplete += new HttpResponseCompleteEventHandler(helper_ResponseComplete);
-            helper.Execute();*/
+            helper.Execute();
+             
+        
+          /*  HttpSendHelper hsh = new HttpSendHelper("POST", FactoryVideoLivre.UpdateBookService,
+                new Dictionary<String, String> { 
+                                                   { "ldtIs", "world" },
+                                                   {"AnnotationLdtFile",newfile.ToString()} 
+                                                });
+            hsh.Execute();*/
+
 
         /** Local Mode **/
             Commands.AnnotationMaker.NewAnnotationFinished.Execute(_newAnnotation,_refElement);
@@ -400,7 +423,7 @@
             OnPropertyChanged("IsControlEnable");
            
         }
-
+        
         private String _sendAnnotationResponse;
         public String SendAnnotationResponse
         {