17 /// <summary> |
17 /// <summary> |
18 /// ViewModel du module BookTimeLine |
18 /// ViewModel du module BookTimeLine |
19 /// </summary> |
19 /// </summary> |
20 public class BookTimeLineVM : BaseMVVM.ViewModel.ViewModel |
20 public class BookTimeLineVM : BaseMVVM.ViewModel.ViewModel |
21 { |
21 { |
|
22 |
|
23 private VideoBook _selectedBook; |
22 /// <summary> |
24 /// <summary> |
23 /// Livre sélectionné |
25 /// Livre sélectionné |
24 /// </summary> |
26 /// </summary> |
25 private VideoBook _selectedBook; |
|
26 public VideoBook SelectedBook |
27 public VideoBook SelectedBook |
27 { |
28 { |
28 get |
29 get |
29 { |
30 { |
30 return _selectedBook; |
31 return _selectedBook; |
31 } |
32 } |
32 } |
33 } |
33 |
34 |
34 /// <summary> |
35 /// <summary> |
35 /// |
36 /// Nom de l'auteur |
36 /// </summary> |
37 /// </summary> |
37 public String AuthorFullname |
38 public String AuthorFullname |
38 { |
39 { |
39 get |
40 get |
40 { |
41 { |
41 return Author.FirstName + " " + Author.Name; |
42 return Author.UserName; |
42 } |
43 } |
43 } |
44 } |
44 |
45 |
|
46 |
|
47 private String _title; |
45 /// <summary> |
48 /// <summary> |
46 /// Titre du Livre |
49 /// Titre du Livre |
47 /// </summary> |
50 /// </summary> |
48 private String _title; |
|
49 public String Title |
51 public String Title |
50 { |
52 { |
51 get |
53 get |
52 { |
54 { |
53 return _title; |
55 return _title; |
95 _selectedBook.Chapters = value; |
98 _selectedBook.Chapters = value; |
96 OnPropertyChanged("Chapters"); |
99 OnPropertyChanged("Chapters"); |
97 } |
100 } |
98 } |
101 } |
99 |
102 |
|
103 |
|
104 private List<SegmentIndex>[] _segmentIndex=new List<SegmentIndex>[4]; |
100 /// <summary> |
105 /// <summary> |
101 /// Liste des Index des Chapitres |
106 /// Liste des Index des Chapitres |
102 /// </summary> |
107 /// </summary> |
103 private List<SegmentIndex>[] _segmentIndex=new List<SegmentIndex>[4]; |
|
104 public List<SegmentIndex>[] SegmentIndex |
108 public List<SegmentIndex>[] SegmentIndex |
105 { |
109 { |
106 get |
110 get |
107 { |
111 { |
108 return _segmentIndex; |
112 return _segmentIndex; |
112 _segmentIndex = value; |
116 _segmentIndex = value; |
113 OnPropertyChanged("SegmentIndex"); |
117 OnPropertyChanged("SegmentIndex"); |
114 } |
118 } |
115 } |
119 } |
116 |
120 |
|
121 |
|
122 private List<Annotation>[] _annotations=new List<Annotation>[4]; |
117 /// <summary> |
123 /// <summary> |
118 /// Liste des Annotations |
124 /// Liste des Annotations |
119 /// </summary> |
125 /// </summary> |
120 private List<Annotation>[] _annotations=new List<Annotation>[4]; |
|
121 public List<Annotation>[] Annotations |
126 public List<Annotation>[] Annotations |
122 { |
127 { |
123 get |
128 get |
124 { |
129 { |
125 return _annotations; |
130 return _annotations; |
129 _annotations = value; |
134 _annotations = value; |
130 OnPropertyChanged("Annotations"); |
135 OnPropertyChanged("Annotations"); |
131 } |
136 } |
132 } |
137 } |
133 |
138 |
|
139 |
|
140 private TimeSpan _totalDuration; |
134 /// <summary> |
141 /// <summary> |
135 /// Durée totale du Livre |
142 /// Durée totale du Livre |
136 /// </summary> |
143 /// </summary> |
137 private TimeSpan _totalDuration; |
|
138 public double TotalDuration |
144 public double TotalDuration |
139 { |
145 { |
140 get |
146 get |
141 { |
147 { |
142 return _totalDuration.TotalMilliseconds; |
148 return _totalDuration.TotalMilliseconds; |
147 _selectedBook.Duration = new TimeSpan(0, 0, 0, 0, (int)value); ; |
153 _selectedBook.Duration = new TimeSpan(0, 0, 0, 0, (int)value); ; |
148 OnPropertyChanged("Duration"); |
154 OnPropertyChanged("Duration"); |
149 } |
155 } |
150 } |
156 } |
151 |
157 |
152 private List<int> _polemicSpectrumData = new List<int>(); |
158 |
153 public List<int> PolemicSpectrumData |
159 private double _position; |
154 { |
|
155 get |
|
156 { |
|
157 return _polemicSpectrumData; |
|
158 } |
|
159 } |
|
160 |
|
161 private List<int> _adhesionSpectrumData = new List<int>(); |
|
162 public List<int> AdhesionSpectrumData |
|
163 { |
|
164 get |
|
165 { |
|
166 return _adhesionSpectrumData; |
|
167 } |
|
168 } |
|
169 |
|
170 private List<int> _referenceSpectrumData = new List<int>(); |
|
171 public List<int> ReferenceSpectrumData |
|
172 { |
|
173 get |
|
174 { |
|
175 return _referenceSpectrumData; |
|
176 } |
|
177 } |
|
178 |
|
179 private List<int> _questionSpectrumData = new List<int>(); |
|
180 public List<int> QuestionSpectrumData |
|
181 { |
|
182 get |
|
183 { |
|
184 return _questionSpectrumData; |
|
185 } |
|
186 } |
|
187 |
|
188 private List<int> _generalSpectrumData = new List<int>(); |
|
189 public List<int> GeneralSpectrumData |
|
190 { |
|
191 get |
|
192 { |
|
193 return _generalSpectrumData; |
|
194 } |
|
195 } |
|
196 |
|
197 /// <summary> |
160 /// <summary> |
198 /// Position du curseur de lecture |
161 /// Position du curseur de lecture |
199 /// </summary> |
162 /// </summary> |
200 private double _position; |
|
201 public double Position |
163 public double Position |
202 { |
164 { |
203 get |
165 get |
204 { |
166 { |
205 return _position; |
167 return _position; |
209 _position = value; |
171 _position = value; |
210 OnPropertyChanged("Position"); |
172 OnPropertyChanged("Position"); |
211 } |
173 } |
212 } |
174 } |
213 |
175 |
214 /// <summary> |
176 |
215 /// Chargement des données et annalyse |
|
216 /// </summary> |
|
217 private void LoadData() |
|
218 { |
|
219 if (_selectedBook.Duration != TimeSpan.Zero) |
|
220 { |
|
221 |
|
222 for (double i = 0; i <= _selectedBook.Duration.TotalMilliseconds; i = (i + _selectedBook.Duration.TotalMilliseconds / 150)) |
|
223 { |
|
224 int[] Tem = new int[4]{0,0,0,0}; |
|
225 foreach (VideoChapter Ch in _selectedBook.Chapters) |
|
226 { |
|
227 foreach (Annotation An in Ch.Annotations) |
|
228 { |
|
229 if (An.TimerIn.TotalMilliseconds <= i && An.TimerOut.TotalMilliseconds >= i) |
|
230 { |
|
231 switch (An.Type) |
|
232 { |
|
233 case PolemicElementType.Polemic: |
|
234 Tem[0]++; |
|
235 break; |
|
236 case PolemicElementType.Adhesion: |
|
237 Tem[1]++; |
|
238 break; |
|
239 case PolemicElementType.Reference: |
|
240 Tem[2]++; |
|
241 break; |
|
242 case PolemicElementType.Question: |
|
243 Tem[3]++; |
|
244 break; |
|
245 default: |
|
246 break; |
|
247 } |
|
248 } |
|
249 } |
|
250 } |
|
251 _polemicSpectrumData.Add(Tem[0]); |
|
252 _adhesionSpectrumData.Add(Tem[1]); |
|
253 _referenceSpectrumData.Add(Tem[2]); |
|
254 _questionSpectrumData.Add(Tem[3]); |
|
255 _generalSpectrumData.Add((Tem[0]+Tem[1]+Tem[2]+Tem[3])); |
|
256 } |
|
257 } |
|
258 |
|
259 |
|
260 } |
|
261 |
177 |
262 /// <summary> |
178 /// <summary> |
263 /// Constructeur |
179 /// Constructeur |
264 /// </summary> |
180 /// </summary> |
265 /// <param name="bookParam">VideoLivre à étudier</param> |
181 /// <param name="bookParam">VideoLivre à étudier</param> |
268 _selectedBook = bookParam; |
184 _selectedBook = bookParam; |
269 _title = bookParam.Title; |
185 _title = bookParam.Title; |
270 _author = bookParam.Author; |
186 _author = bookParam.Author; |
271 _chapters = bookParam.Chapters; |
187 _chapters = bookParam.Chapters; |
272 _totalDuration = bookParam.Duration; |
188 _totalDuration = bookParam.Duration; |
273 LoadData(); |
|
274 LoadElements(); |
189 LoadElements(); |
275 Commands.TimeChange.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(TimeChange_Executed); |
190 Commands.TimeChange.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(TimeChange_Executed); |
276 |
191 |
277 } |
192 } |
|
193 |
278 private VideoViewerVM _videoViewerVM; |
194 private VideoViewerVM _videoViewerVM; |
|
195 /// <summary> |
|
196 /// ViewModel de VideoViewer |
|
197 /// </summary> |
279 public VideoViewerVM ViewModelVideoViewer |
198 public VideoViewerVM ViewModelVideoViewer |
280 { |
199 { |
281 get |
200 get |
282 { |
201 { |
283 return _videoViewerVM; |
202 return _videoViewerVM; |
286 { |
205 { |
287 _videoViewerVM = value; |
206 _videoViewerVM = value; |
288 OnPropertyChanged("ViewModelVideoViewer"); |
207 OnPropertyChanged("ViewModelVideoViewer"); |
289 } |
208 } |
290 } |
209 } |
291 void TimeChange_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
210 private void TimeChange_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e) |
292 { |
211 { |
293 // Position = ((Slider)e.Parameter).Value; |
|
294 // Commands.VideoViewer.Pause.Execute(); |
|
295 if(e.Source == this) |
212 if(e.Source == this) |
296 { |
213 { |
297 ViewModelVideoViewer.GoTo(TimeSpan.FromMilliseconds(((double)e.Parameter))); |
214 ViewModelVideoViewer.GoTo(TimeSpan.FromMilliseconds(((double)e.Parameter))); |
298 } |
215 } |
299 //Commands.GoToTime.Execute(((Slider)e.Parameter).Value); |
|
300 |
|
301 // Commands.VideoViewer.Play.Execute(); |
|
302 } |
216 } |
303 |
217 |
304 |
218 |
305 /// <summary> |
219 /// <summary> |
306 /// Chargement des éléments du livre (Index et Annotations) |
220 /// Chargement des éléments du livre (Index et Annotations) |