client/src/Iri.Modernisation.Controls/ViewModel/AnnotationMaker/AnnotationMakerVM.cs
changeset 25 a9c815025a1b
parent 0 249d70e7b32d
child 28 2d4ec5ab2a40
equal deleted inserted replaced
24:c031f1132dde 25:a9c815025a1b
    21     /// <summary>
    21     /// <summary>
    22     /// ViewModel du module d'annotation
    22     /// ViewModel du module d'annotation
    23     /// </summary>
    23     /// </summary>
    24     public class AnnotationMakerVM : BaseMVVM.ViewModel.ViewModel
    24     public class AnnotationMakerVM : BaseMVVM.ViewModel.ViewModel
    25     {
    25     {
       
    26        
       
    27         private PolemicElement _refElement;
    26         /// <summary>
    28         /// <summary>
    27         /// Element référent
    29         /// Element référent
    28         /// </summary>
    30         /// </summary>
    29         private PolemicElement _refElement;
       
    30         public PolemicElement RefElement
    31         public PolemicElement RefElement
    31         {
    32         {
    32             get
    33             get
    33             {
    34             {
    34                 return _refElement;
    35                 return _refElement;
    53 
    54 
    54         /// <summary>
    55         /// <summary>
    55         /// Savoir si le module de liens est activé
    56         /// Savoir si le module de liens est activé
    56         /// </summary>
    57         /// </summary>
    57         public bool IsBinderActive { get; set; }
    58         public bool IsBinderActive { get; set; }
       
    59         /// <summary>
       
    60         /// Liste des Tags Référants
       
    61         /// </summary>
    58         public List<String> RefTags
    62         public List<String> RefTags
    59         {
    63         {
    60             get
    64             get
    61             {
    65             {
    62                 if (_refElement != null)
    66                 if (_refElement != null)
    73         /// <summary>
    77         /// <summary>
    74         /// Annotation créé
    78         /// Annotation créé
    75         /// </summary>
    79         /// </summary>
    76         private Annotation _newAnnotation;
    80         private Annotation _newAnnotation;
    77 
    81 
       
    82         
       
    83         private TimeSpan _begin;
    78         /// <summary>
    84         /// <summary>
    79         /// Temps de début de l'annotation
    85         /// Temps de début de l'annotation
    80         /// </summary>
    86         /// </summary>
    81         private TimeSpan _begin;
       
    82         public double Begin 
    87         public double Begin 
    83         {
    88         {
    84             get
    89             get
    85             {
    90             {
    86                 return _begin.TotalMilliseconds;
    91                 return _begin.TotalMilliseconds;
    91                 _newAnnotation.TimerIn = TimeSpan.FromMilliseconds(value);
    96                 _newAnnotation.TimerIn = TimeSpan.FromMilliseconds(value);
    92                 OnPropertyChanged("Begin");
    97                 OnPropertyChanged("Begin");
    93             }
    98             }
    94         }
    99         }
    95 
   100 
       
   101         
       
   102         private TimeSpan _end;
    96         /// <summary>
   103         /// <summary>
    97         /// Temps de fin de l'annotation
   104         /// Temps de fin de l'annotation
    98         /// </summary>
   105         /// </summary>
    99         private TimeSpan _end;
       
   100         public double End
   106         public double End
   101         {
   107         {
   102             get
   108             get
   103             {
   109             {
   104                 return _end.TotalMilliseconds;
   110                 return _end.TotalMilliseconds;
   109                 _newAnnotation.TimerOut = TimeSpan.FromMilliseconds(value);
   115                 _newAnnotation.TimerOut = TimeSpan.FromMilliseconds(value);
   110                 OnPropertyChanged("End");
   116                 OnPropertyChanged("End");
   111             }
   117             }
   112         }
   118         }
   113 
   119 
       
   120    
       
   121         private PolemicElementType _type;
   114         /// <summary>
   122         /// <summary>
   115         /// Type de l'annotation
   123         /// Type de l'annotation
   116         /// </summary>
   124         /// </summary>
   117         private PolemicElementType _type;
       
   118         public PolemicElementType Type 
   125         public PolemicElementType Type 
   119         {
   126         {
   120             get
   127             get
   121             {
   128             {
   122                 return _type;
   129                 return _type;
   127                 _newAnnotation.Type = value;
   134                 _newAnnotation.Type = value;
   128                 OnPropertyChanged("Type");
   135                 OnPropertyChanged("Type");
   129             }
   136             }
   130         }
   137         }
   131 
   138 
       
   139         
       
   140         private Rectangle _selectedType;
   132         /// <summary>
   141         /// <summary>
   133         /// Convertion Rectange
   142         /// Convertion Rectange
   134         /// </summary>
   143         /// </summary>
   135         private Rectangle _selectedType;
       
   136         public Rectangle SelectedType
   144         public Rectangle SelectedType
   137         {
   145         {
   138             get
   146             get
   139             {
   147             {
   140                 return _selectedType;
   148                 return _selectedType;
   145                
   153                
   146                 Type = (PolemicElementType)((Rectangle)_selectedType).Resources["PolemicType"];
   154                 Type = (PolemicElementType)((Rectangle)_selectedType).Resources["PolemicType"];
   147             }
   155             }
   148         }
   156         }
   149 
   157 
       
   158         private String _title;
   150         /// <summary>
   159         /// <summary>
   151         /// Titre de l'annotation
   160         /// Titre de l'annotation
   152         /// </summary>
   161         /// </summary>
   153         private String _title;
       
   154         public String Title
   162         public String Title
   155         {
   163         {
   156             get
   164             get
   157             { return _title; }
   165             { return _title; }
   158             set
   166             set
   161                 _newAnnotation.Title = value;
   169                 _newAnnotation.Title = value;
   162                 OnPropertyChanged("Title");
   170                 OnPropertyChanged("Title");
   163             }
   171             }
   164         }
   172         }
   165 
   173 
       
   174         private String _description;
       
   175 
   166         /// <summary>
   176         /// <summary>
   167         /// Description de l'annotation
   177         /// Description de l'annotation
   168         /// </summary>
   178         /// </summary>
   169         private String _description;
       
   170         public String Description
   179         public String Description
   171         {
   180         {
   172             get
   181             get
   173             {
   182             {
   174                 return _description;
   183                 return _description;
   184 
   193 
   185         /// <summary>
   194         /// <summary>
   186         /// Tags de l'annotation
   195         /// Tags de l'annotation
   187         /// </summary>
   196         /// </summary>
   188         public List<String> _tags =new List<String>();
   197         public List<String> _tags =new List<String>();
       
   198         /// <summary>
       
   199         /// Tags de l'annotation
       
   200         /// </summary>
   189         public String Tags
   201         public String Tags
   190         {
   202         {
   191             get
   203             get
   192             {
   204             {
   193                 try
   205                 try
   208                
   220                
   209                 
   221                 
   210             }
   222             }
   211         }
   223         }
   212 
   224 
       
   225      
       
   226         private PolemicLink _basicRelation;
   213         /// <summary>
   227         /// <summary>
   214         /// Relation basique
   228         /// Relation basique
   215         /// </summary>
   229         /// </summary>
   216         private PolemicLink _basicRelation;
       
   217         public PolemicLink BasicRelation
   230         public PolemicLink BasicRelation
   218         {
   231         {
   219             get
   232             get
   220             {
   233             {
   221                 return _basicRelation;
   234                 return _basicRelation;
   227             }
   240             }
   228 
   241 
   229 
   242 
   230         }
   243         }
   231 
   244 
       
   245       
       
   246         private PolemicLink _polemicRelation;
   232         /// <summary>
   247         /// <summary>
   233         /// Relation polémique
   248         /// Relation polémique
   234         /// </summary>
   249         /// </summary>
   235         private PolemicLink _polemicRelation;
       
   236         public PolemicLink PolemicRelation
   250         public PolemicLink PolemicRelation
   237         {
   251         {
   238             get
   252             get
   239             {
   253             {
   240 
   254 
   270             Commands.ContextualBinderLayer.ActiveBind.Executed += new EventHandler<ExecutedEventArgs>(ActiveBind_Executed);
   284             Commands.ContextualBinderLayer.ActiveBind.Executed += new EventHandler<ExecutedEventArgs>(ActiveBind_Executed);
   271             Commands.ContextualBinderLayer.DesactiveBind.Executed += new EventHandler<ExecutedEventArgs>(DesactiveBind_Executed);
   285             Commands.ContextualBinderLayer.DesactiveBind.Executed += new EventHandler<ExecutedEventArgs>(DesactiveBind_Executed);
   272             Commands.AnnotationMaker.OkClick.Executed += new EventHandler<ExecutedEventArgs>(OkClickAnnotationMaker_Executed);
   286             Commands.AnnotationMaker.OkClick.Executed += new EventHandler<ExecutedEventArgs>(OkClickAnnotationMaker_Executed);
   273         }
   287         }
   274 
   288 
   275         void DesactiveBind_Executed(object sender, ExecutedEventArgs e)
   289         private void DesactiveBind_Executed(object sender, ExecutedEventArgs e)
   276         {
   290         {
   277             IsBinderActive = false;
   291             IsBinderActive = false;
   278         }
   292         }
   279 
   293 
   280         void ActiveBind_Executed(object sender, ExecutedEventArgs e)
   294         private void ActiveBind_Executed(object sender, ExecutedEventArgs e)
   281         {
   295         {
   282             IsBinderActive = true;
   296             IsBinderActive = true;
   283         }
   297         }
   284 
   298 
   285       
   299       
   286 
   300 
   287         void SelectBind_Executed(object sender, ExecutedEventArgs e)
   301         private void SelectBind_Executed(object sender, ExecutedEventArgs e)
   288         {
   302         {
   289             if (IsControlEnable && IsBinderActive )
   303             if (IsControlEnable && IsBinderActive )
   290             {
   304             {
   291                 PolemicRelation.ToElement = (PolemicElement)e.Source;
   305                 PolemicRelation.ToElement = (PolemicElement)e.Source;
   292                 OnPropertyChanged("PolemicRelation");
   306                 OnPropertyChanged("PolemicRelation");
   293             }
   307             }
   294                 
   308                 
   295         }
   309         }
   296 
   310 
   297         void BeginBind_Executed(object sender, ExecutedEventArgs e)
   311         private void BeginBind_Executed(object sender, ExecutedEventArgs e)
   298         {
   312         {
   299             if (IsControlEnable)
   313             if (IsControlEnable)
   300             {
   314             {
   301                 PolemicRelation.Type = ((ContextualLinkBinder)e.Parameter).PolemicType;
   315                 PolemicRelation.Type = ((ContextualLinkBinder)e.Parameter).PolemicType;
   302                 PolemicRelation.ToElement = null;
   316                 PolemicRelation.ToElement = null;
   306 
   320 
   307         }
   321         }
   308 
   322 
   309       
   323       
   310 
   324 
   311         void OkClickAnnotationMaker_Executed(object sender, ExecutedEventArgs e)
   325         private void OkClickAnnotationMaker_Executed(object sender, ExecutedEventArgs e)
   312         {
   326         {
   313             String message = "Ok clicked "+Type+" \n";
   327             String message = "Ok clicked "+Type+" \n";
   314             message += _begin + "-->" + _end;
   328             message += _begin + "-->" + _end;
   315             message += "\n" + Title;
   329             message += "\n" + Title;
   316             message += "\n" + Description;
   330             message += "\n" + Description;