diff -r bd33267300aa -r 0f2bde8fdfeb client/src/Iri.Modernisation.Controls/ViewModel/AnnotationMaker/AnnotationMakerVM.cs --- 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() { new LDTMedia() @@ -342,7 +351,7 @@ Src = _refElement.Chapter.Book.IriPath } }, - Relations = new List() + BasicRelations = new List() { new LDTRelation() { @@ -351,6 +360,7 @@ //Title = _basicRelation.Title } }, + Annotations = new List() { 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("authKey", "123456" ), - new KeyValuePair("newAnnotation", newfile.ToString()), - new KeyValuePair("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("newAnnotation",System.Windows.Browser.HttpUtility.UrlEncode( + System.Windows.Browser.HttpUtility.HtmlEncode( + _refElement.Chapter.Book.GetLDTFile().ToString()) + )), + new KeyValuePair("ldtFileURI",_refElement.Chapter.Book.LdtPath)); helper.ResponseComplete += new HttpResponseCompleteEventHandler(helper_ResponseComplete); - helper.Execute();*/ + helper.Execute(); + + + /* HttpSendHelper hsh = new HttpSendHelper("POST", FactoryVideoLivre.UpdateBookService, + new Dictionary { + { "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 {