client/src/Iri.Modernisation.Controls/ViewModel/AnnotationMaker/AnnotationMakerVM.cs
changeset 38 bd33267300aa
parent 36 b6df6fce6e5d
child 39 0f2bde8fdfeb
equal deleted inserted replaced
37:beb938b4fb76 38:bd33267300aa
   309         {
   309         {
   310             if (IsControlEnable)
   310             if (IsControlEnable)
   311             {
   311             {
   312                 PolemicRelation.Type = ((ContextualLinkBinder)e.Parameter).PolemicType;
   312                 PolemicRelation.Type = ((ContextualLinkBinder)e.Parameter).PolemicType;
   313                 PolemicRelation.ToElement = null;
   313                 PolemicRelation.ToElement = null;
   314                 OnPropertyChanged("PolemicRelation");
   314                 OnPropertyChanged("PolemicRelation");  
   315                 
       
   316             }
   315             }
   317 
   316 
   318         }
   317         }
   319 
   318 
   320       
   319       
   321 
   320 
   322         private void OkClickAnnotationMaker_Executed(object sender, ExecutedEventArgs e)
   321         private void OkClickAnnotationMaker_Executed(object sender, ExecutedEventArgs e)
   323         {
   322         {
   324             LDTElement newAnnotation = new LDTElement();
   323             _newAnnotation.Type = _selectedType ;
       
   324             _basicRelation.ToElement = _newAnnotation;
       
   325             LDTElement newAnnotation = new LDTElement(_newAnnotation);
       
   326             
       
   327            /* 
   325             newAnnotation.Title = Title;
   328             newAnnotation.Title = Title;
   326             newAnnotation.Abstract = Description;
   329             newAnnotation.Abstract = Description;
   327             newAnnotation.Begin = Begin;
   330             newAnnotation.Begin = Begin;
   328             newAnnotation.Dur = End - Begin;
   331             newAnnotation.Dur = End - Begin;
   329             newAnnotation.Tags = _tags;
   332             newAnnotation.Tags = _tags; 
   330             
       
   331             newAnnotation.Color = int.Parse(_selectedType.Color.A.ToString() + _selectedType.Color.R.ToString() + _selectedType.Color.G.ToString() + _selectedType.Color.B.ToString());
   333             newAnnotation.Color = int.Parse(_selectedType.Color.A.ToString() + _selectedType.Color.R.ToString() + _selectedType.Color.G.ToString() + _selectedType.Color.B.ToString());
   332            
   334            */
   333             
   335             
   334             LDTFile newfile = new LDTFile()
   336             LDTFile newfile = new LDTFile()
   335             {
   337             {
   336                 Medias  = new List<LDTMedia>()
   338                 Medias  = new List<LDTMedia>()
   337                 {
   339                 {
   377                 };
   379                 };
   378                 newfile.Relations.Add(polemicRelation);
   380                 newfile.Relations.Add(polemicRelation);
   379             }
   381             }
   380             //MessageBox.Show(newfile.ToString());
   382             //MessageBox.Show(newfile.ToString());
   381            
   383            
   382             
   384             /** HttpSend For Web Mode **/
   383             Application app = Application.Current as Application;
   385            /* Application app = Application.Current as Application;
   384             HttpSender helper = new HttpSender(new Uri("http://mtotet.free.fr/TestHttpSender/index.php"), "POST",
   386             HttpSender helper = new HttpSender(new Uri("http://mtotet.free.fr/TestHttpSender/index.php"), "POST",
   385                 new KeyValuePair<string, string>("authKey", "123456" ),
   387                 new KeyValuePair<string, string>("authKey", "123456" ),
   386                 new KeyValuePair<string, string>("newAnnotation", newfile.ToString()),
   388                 new KeyValuePair<string, string>("newAnnotation", newfile.ToString()),
   387                 new KeyValuePair<string, string>("msg", "303"));
   389                 new KeyValuePair<string, string>("msg", "303"));
   388             helper.ResponseComplete += new HttpResponseCompleteEventHandler(helper_ResponseComplete);
   390             helper.ResponseComplete += new HttpResponseCompleteEventHandler(helper_ResponseComplete);
   389            // helper.Execute();
   391             helper.Execute();*/
   390             MessageBox.Show(newfile.ToString());
   392 
       
   393         /** Local Mode **/
       
   394             Commands.AnnotationMaker.NewAnnotationFinished.Execute(_newAnnotation,_refElement);
       
   395 
       
   396             /********/
       
   397 
       
   398 
   391             _refElement = null;
   399             _refElement = null;
   392             OnPropertyChanged("IsControlEnable");
   400             OnPropertyChanged("IsControlEnable");
   393             
   401            
   394         }
   402         }
   395 
   403 
       
   404         private String _sendAnnotationResponse;
       
   405         public String SendAnnotationResponse
       
   406         {
       
   407             get
       
   408             {
       
   409                 return _sendAnnotationResponse;
       
   410             }
       
   411             set
       
   412             {
       
   413                 _sendAnnotationResponse = value;
       
   414                 OnPropertyChanged("SendAnnotationResponse");
       
   415             }
       
   416         }
   396         void helper_ResponseComplete(HttpResponseCompleteEventArgs e)
   417         void helper_ResponseComplete(HttpResponseCompleteEventArgs e)
   397         {
   418         {
   398             String resp = e.Response;
   419             SendAnnotationResponse = e.Response;
   399             MessageBox.Show(resp);
   420             Commands.HttpSenderResponse.Execute(e.Response);
   400         
   421         
   401         }
   422         }
   402 
   423 
   403         /// <summary>
   424         /// <summary>
   404         /// Constructeur par défaut
   425         /// Constructeur par défaut