client/src/Iri.Modernisation.Controls/ViewModel/ConsultationView/ConsultationViewVM.cs
changeset 25 a9c815025a1b
parent 23 10acb6a11a73
child 30 644e3cd48034
equal deleted inserted replaced
24:c031f1132dde 25:a9c815025a1b
    11 using System.Collections.Generic;
    11 using System.Collections.Generic;
    12 using Iri.Modernisation.Data.Models;
    12 using Iri.Modernisation.Data.Models;
    13 using Iri.Modernisation.Data.LDTClass;
    13 using Iri.Modernisation.Data.LDTClass;
    14 using Iri.Modernisation.BaseMVVM.Commands;
    14 using Iri.Modernisation.BaseMVVM.Commands;
    15 using Iri.Modernisation.BaseMVVM.ViewModel;
    15 using Iri.Modernisation.BaseMVVM.ViewModel;
       
    16 using System.Collections.ObjectModel;
    16 namespace Iri.Modernisation.Controls.ViewModel
    17 namespace Iri.Modernisation.Controls.ViewModel
    17 {
    18 {
       
    19     /// <summary>
       
    20     /// ViewModel de ConsultationView
       
    21     /// </summary>
    18     public class ConsultationViewVM : BaseMVVM.ViewModel.ViewModel
    22     public class ConsultationViewVM : BaseMVVM.ViewModel.ViewModel
    19     {
    23     {
    20         private PolemicElement _selectedElement;
    24         private PolemicElement _selectedElement;
       
    25         /// <summary>
       
    26         /// PolemicElement sélectionné
       
    27         /// </summary>
    21         public PolemicElement SelectedElement
    28         public PolemicElement SelectedElement
    22         {
    29         {
    23             get
    30             get
    24             {
    31             {
    25                 return _selectedElement;
    32                 return _selectedElement;
    31             }
    38             }
    32         }
    39         }
    33 
    40 
    34 
    41 
    35 
    42 
    36         private SLExtensions.Collections.ObjectModel.ObservableCollection<BookTimeLineVM> _selectedVideoBooks;
    43         private ObservableCollection<BookTimeLineVM> _selectedVideoBooks;
    37         public SLExtensions.Collections.ObjectModel.ObservableCollection<BookTimeLineVM> SelectedVideoBooks
    44         /// <summary>
       
    45         /// Liste des Livres Sélectionnés
       
    46         /// </summary>
       
    47         public ObservableCollection<BookTimeLineVM> SelectedVideoBooks
    38         {
    48         {
    39             get
    49             get
    40             {
    50             {
    41 
    51 
    42                 return _selectedVideoBooks;
    52                 return _selectedVideoBooks;
    47                 OnPropertyChanged("SelectedVideoBooks");
    57                 OnPropertyChanged("SelectedVideoBooks");
    48             }
    58             }
    49         }
    59         }
    50 
    60 
    51         private int _selectedVideoBookIndex=-1;
    61         private int _selectedVideoBookIndex=-1;
       
    62         /// <summary>
       
    63         /// Index du livre sélectionné
       
    64         /// </summary>
    52         public int SelectedVideoBookIndex
    65         public int SelectedVideoBookIndex
    53         {
    66         {
    54             get
    67             get
    55             {
    68             {
    56                 return _selectedVideoBookIndex;
    69                 return _selectedVideoBookIndex;
    63                
    76                
    64             }
    77             }
    65         }
    78         }
    66 
    79 
    67         private ConsultationBookViewVM _consultationBookViewContextMenu;
    80         private ConsultationBookViewVM _consultationBookViewContextMenu;
       
    81         /// <summary>
       
    82         /// ViewModel de ConsultationBook
       
    83         /// </summary>
    68         public ConsultationBookViewVM ConsultationBookViewContextMenu
    84         public ConsultationBookViewVM ConsultationBookViewContextMenu
    69         {
    85         {
    70             get
    86             get
    71             {
    87             {
    72                 return _consultationBookViewContextMenu;
    88                 return _consultationBookViewContextMenu;
    84             Commands.PolemicElement.SelectPolemicElement.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(SelectPolemicElement_Executed);
   100             Commands.PolemicElement.SelectPolemicElement.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(SelectPolemicElement_Executed);
    85        
   101        
    86             Commands.ClickMenu.CreateNewTextualAnnotation.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(CreateNewTextualAnnotation_Executed);
   102             Commands.ClickMenu.CreateNewTextualAnnotation.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(CreateNewTextualAnnotation_Executed);
    87         }
   103         }
    88 
   104 
    89         void ClickBook_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
   105         private void ClickBook_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
    90         {
   106         {
    91             BookTimeLineVM temp = new BookTimeLineVM((VideoBook)e.Parameter);
   107             BookTimeLineVM temp = new BookTimeLineVM((VideoBook)e.Parameter);
    92             temp.ViewModelVideoViewer = ConsultationBookViewContextMenu.ActualVideoSourceVM;
   108             temp.ViewModelVideoViewer = ConsultationBookViewContextMenu.ActualVideoSourceVM;
    93             bool CanAdd = true;
   109             bool CanAdd = true;
    94            foreach(BookTimeLineVM BookTLVM in SelectedVideoBooks)
   110            foreach(BookTimeLineVM BookTLVM in SelectedVideoBooks)
   105 
   121 
   106         }
   122         }
   107 
   123 
   108       
   124       
   109         private AnnotationMakerVM _annotationMakerVM;
   125         private AnnotationMakerVM _annotationMakerVM;
       
   126         /// <summary>
       
   127         /// ViewModel de AnnotationMaker
       
   128         /// </summary>
   110         public AnnotationMakerVM ViewModelAnnotationMaker
   129         public AnnotationMakerVM ViewModelAnnotationMaker
   111         {
   130         {
   112             get
   131             get
   113             {
   132             {
   114                 return _annotationMakerVM;
   133                 return _annotationMakerVM;
   115             }
   134             }
   116         }
   135         }
   117         void CreateNewTextualAnnotation_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
   136         private void CreateNewTextualAnnotation_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
   118         {
   137         {
   119             ViewModelAnnotationMaker.RefElement = SelectedElement;
   138             ViewModelAnnotationMaker.RefElement = SelectedElement;
   120         }
   139         }
   121         public ConsultationViewVM()
   140         public ConsultationViewVM()
   122         {
   141         {
   124             _consultationBookViewContextMenu = new ConsultationBookViewVM();
   143             _consultationBookViewContextMenu = new ConsultationBookViewVM();
   125             _annotationMakerVM = new AnnotationMakerVM();
   144             _annotationMakerVM = new AnnotationMakerVM();
   126             SelectedVideoBooks = new SLExtensions.Collections.ObjectModel.ObservableCollection<BookTimeLineVM>();
   145             SelectedVideoBooks = new SLExtensions.Collections.ObjectModel.ObservableCollection<BookTimeLineVM>();
   127         }
   146         }
   128 
   147 
   129         void SelectPolemicElement_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
   148         private void SelectPolemicElement_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
   130         {
   149         {
   131             SelectedElement= (PolemicElement)e.Parameter;
   150             SelectedElement= (PolemicElement)e.Parameter;
   132             try
   151             try
   133             {
   152             {
   134                 ConsultationBookViewContextMenu.SelectedIndex = (SegmentIndex)SelectedElement;
   153                 ConsultationBookViewContextMenu.SelectedIndex = (SegmentIndex)SelectedElement;