|
0
|
1 |
using System; |
|
|
2 |
using System.Net; |
|
|
3 |
using System.Windows; |
|
|
4 |
using System.Windows.Controls; |
|
|
5 |
using System.Windows.Documents; |
|
|
6 |
using System.Windows.Ink; |
|
|
7 |
using System.Windows.Input; |
|
|
8 |
using System.Windows.Media; |
|
|
9 |
using System.Windows.Media.Animation; |
|
|
10 |
using System.Windows.Shapes; |
|
|
11 |
using System.Collections.Generic; |
|
|
12 |
using Iri.Modernisation.Data.Models; |
|
|
13 |
using Iri.Modernisation.Data.LDTClass; |
|
|
14 |
using Iri.Modernisation.BaseMVVM.Commands; |
|
|
15 |
using Iri.Modernisation.BaseMVVM.ViewModel; |
|
25
|
16 |
using System.Collections.ObjectModel; |
|
0
|
17 |
namespace Iri.Modernisation.Controls.ViewModel |
|
|
18 |
{ |
|
25
|
19 |
/// <summary> |
|
|
20 |
/// ViewModel de ConsultationView |
|
|
21 |
/// </summary> |
|
0
|
22 |
public class ConsultationViewVM : BaseMVVM.ViewModel.ViewModel |
|
|
23 |
{ |
|
|
24 |
private PolemicElement _selectedElement; |
|
25
|
25 |
/// <summary> |
|
|
26 |
/// PolemicElement sélectionné |
|
|
27 |
/// </summary> |
|
0
|
28 |
public PolemicElement SelectedElement |
|
|
29 |
{ |
|
|
30 |
get |
|
|
31 |
{ |
|
|
32 |
return _selectedElement; |
|
|
33 |
} |
|
|
34 |
set |
|
|
35 |
{ |
|
|
36 |
_selectedElement = value; |
|
|
37 |
OnPropertyChanged("SelectedElement"); |
|
|
38 |
} |
|
|
39 |
} |
|
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
25
|
43 |
private ObservableCollection<BookTimeLineVM> _selectedVideoBooks; |
|
|
44 |
/// <summary> |
|
|
45 |
/// Liste des Livres Sélectionnés |
|
|
46 |
/// </summary> |
|
|
47 |
public ObservableCollection<BookTimeLineVM> SelectedVideoBooks |
|
0
|
48 |
{ |
|
|
49 |
get |
|
|
50 |
{ |
|
|
51 |
|
|
|
52 |
return _selectedVideoBooks; |
|
|
53 |
} |
|
|
54 |
set |
|
|
55 |
{ |
|
|
56 |
_selectedVideoBooks = value; |
|
|
57 |
OnPropertyChanged("SelectedVideoBooks"); |
|
|
58 |
} |
|
|
59 |
} |
|
|
60 |
|
|
|
61 |
private int _selectedVideoBookIndex=-1; |
|
25
|
62 |
/// <summary> |
|
|
63 |
/// Index du livre sélectionné |
|
|
64 |
/// </summary> |
|
0
|
65 |
public int SelectedVideoBookIndex |
|
|
66 |
{ |
|
|
67 |
get |
|
|
68 |
{ |
|
|
69 |
return _selectedVideoBookIndex; |
|
|
70 |
} |
|
|
71 |
set |
|
|
72 |
{ |
|
|
73 |
_selectedVideoBookIndex= value; |
|
|
74 |
OnPropertyChanged("SelectedVideoBookIndex"); |
|
|
75 |
ConsultationBookViewContextMenu.SelectedBookVM = (_selectedVideoBooks[value]); |
|
|
76 |
|
|
|
77 |
} |
|
|
78 |
} |
|
|
79 |
|
|
|
80 |
private ConsultationBookViewVM _consultationBookViewContextMenu; |
|
25
|
81 |
/// <summary> |
|
|
82 |
/// ViewModel de ConsultationBook |
|
|
83 |
/// </summary> |
|
0
|
84 |
public ConsultationBookViewVM ConsultationBookViewContextMenu |
|
|
85 |
{ |
|
|
86 |
get |
|
|
87 |
{ |
|
|
88 |
return _consultationBookViewContextMenu; |
|
|
89 |
} |
|
|
90 |
set |
|
|
91 |
{ |
|
|
92 |
_consultationBookViewContextMenu = value; |
|
|
93 |
OnPropertyChanged(null); |
|
|
94 |
} |
|
|
95 |
} |
|
|
96 |
|
|
|
97 |
private void InitializeCommands() |
|
|
98 |
{ |
|
|
99 |
Commands.ConsultMenu.ClickBook.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(ClickBook_Executed); |
|
|
100 |
Commands.PolemicElement.SelectPolemicElement.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(SelectPolemicElement_Executed); |
|
|
101 |
|
|
|
102 |
Commands.ClickMenu.CreateNewTextualAnnotation.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(CreateNewTextualAnnotation_Executed); |
|
|
103 |
} |
|
|
104 |
|
|
25
|
105 |
private void ClickBook_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
|
0
|
106 |
{ |
|
|
107 |
BookTimeLineVM temp = new BookTimeLineVM((VideoBook)e.Parameter); |
|
23
|
108 |
temp.ViewModelVideoViewer = ConsultationBookViewContextMenu.ActualVideoSourceVM; |
|
0
|
109 |
bool CanAdd = true; |
|
|
110 |
foreach(BookTimeLineVM BookTLVM in SelectedVideoBooks) |
|
|
111 |
{ |
|
|
112 |
if (BookTLVM.SelectedBook == (VideoBook)e.Parameter) |
|
|
113 |
{ |
|
|
114 |
CanAdd = false; |
|
|
115 |
} |
|
|
116 |
} |
|
|
117 |
if(CanAdd) |
|
|
118 |
{ |
|
|
119 |
SelectedVideoBooks.Add(temp); |
|
|
120 |
} |
|
|
121 |
|
|
|
122 |
} |
|
|
123 |
|
|
|
124 |
|
|
|
125 |
private AnnotationMakerVM _annotationMakerVM; |
|
25
|
126 |
/// <summary> |
|
|
127 |
/// ViewModel de AnnotationMaker |
|
|
128 |
/// </summary> |
|
0
|
129 |
public AnnotationMakerVM ViewModelAnnotationMaker |
|
|
130 |
{ |
|
|
131 |
get |
|
|
132 |
{ |
|
|
133 |
return _annotationMakerVM; |
|
|
134 |
} |
|
|
135 |
} |
|
25
|
136 |
private void CreateNewTextualAnnotation_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
|
0
|
137 |
{ |
|
|
138 |
ViewModelAnnotationMaker.RefElement = SelectedElement; |
|
|
139 |
} |
|
|
140 |
public ConsultationViewVM() |
|
|
141 |
{ |
|
|
142 |
InitializeCommands(); |
|
|
143 |
_consultationBookViewContextMenu = new ConsultationBookViewVM(); |
|
|
144 |
_annotationMakerVM = new AnnotationMakerVM(); |
|
|
145 |
SelectedVideoBooks = new SLExtensions.Collections.ObjectModel.ObservableCollection<BookTimeLineVM>(); |
|
|
146 |
} |
|
|
147 |
|
|
25
|
148 |
private void SelectPolemicElement_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
|
0
|
149 |
{ |
|
|
150 |
SelectedElement= (PolemicElement)e.Parameter; |
|
|
151 |
try |
|
|
152 |
{ |
|
|
153 |
ConsultationBookViewContextMenu.SelectedIndex = (SegmentIndex)SelectedElement; |
|
|
154 |
} |
|
|
155 |
catch |
|
|
156 |
{ |
|
|
157 |
} |
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
} |
|
|
162 |
} |
|
|
163 |
} |