author | PAMPHILE Jonathan <pamphile@efrei.fr> |
Thu, 12 Nov 2009 23:50:31 +0100 | |
changeset 193 | 96374d03e714 |
parent 189 | b37888f59cf2 |
child 195 | 48b3139bb182 |
permissions | -rw-r--r-- |
3 | 1 |
using System; |
2 |
using System.IO; |
|
3 |
using System.Net; |
|
4 |
using System.Windows; |
|
5 |
using System.Windows.Controls; |
|
6 |
using System.Windows.Data; |
|
7 |
using System.Windows.Media; |
|
8 |
using System.Windows.Media.Imaging; |
|
9 |
using System.Windows.Media.Animation; |
|
10 |
using System.Windows.Navigation; |
|
11 |
using System.ComponentModel; |
|
49 | 12 |
using System.Reflection; |
143 | 13 |
using System.Collections.Generic; |
14 |
||
15 |
using Microsoft.Surface.Presentation; |
|
16 |
using Microsoft.Surface.Presentation.Controls; |
|
156
e16c8c913c65
Color Factory et application des couleurs au pivot
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
146
diff
changeset
|
17 |
using FingersDance.Factory; |
143 | 18 |
using FingersDance.Actions; |
19 |
using FingersDance.Control.TimeLine; |
|
20 |
using FingersDance.Views; |
|
21 |
using FingersDance.ViewModels; |
|
174 | 22 |
using GestureControl; |
3 | 23 |
|
24 |
namespace FingersDance.Control.Player |
|
25 |
{ |
|
26 |
public partial class UserControlPlayer |
|
27 |
{ |
|
34 | 28 |
#region Variables |
29 |
private bool isPlaying = false; |
|
30 |
#endregion |
|
3 | 31 |
|
34 | 32 |
public event EventHandler PlayerOpened; |
165 | 33 |
public event EventHandler PlayerStopOrPause; |
168
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
34 |
|
193 | 35 |
public double Time |
36 |
{ |
|
37 |
get { return gestureControl.time; } |
|
38 |
set { gestureControl.time = value; } |
|
39 |
} |
|
40 |
||
170 | 41 |
#region constructors |
119 | 42 |
public UserControlPlayer() |
43 |
{ |
|
44 |
this.InitializeComponent(); |
|
121
32611257e99f
Link PLayer - SessionInput
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
119
diff
changeset
|
45 |
MediaElementVideo.LoadedBehavior = MediaState.Manual; |
32611257e99f
Link PLayer - SessionInput
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
119
diff
changeset
|
46 |
MediaElementVideo.UnloadedBehavior = MediaState.Manual; |
173
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
47 |
//SAR |
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
48 |
//Control User Info |
170 | 49 |
usercontrolInfoUser.LabelSession.Content = "Seance Test"; |
50 |
usercontrolInfoUser.LabelUser.Content = "User Test"; |
|
119 | 51 |
} |
174 | 52 |
|
170 | 53 |
#endregion |
54 |
||
34 | 55 |
#region Properties |
56 |
public double TotalMilliseconds |
|
57 |
{ |
|
58 |
get |
|
59 |
{ |
|
60 |
return MediaElementVideo.NaturalDuration.TimeSpan.TotalMilliseconds; |
|
61 |
} |
|
62 |
} |
|
63 |
public MediaElement Player |
|
64 |
{ |
|
65 |
get |
|
66 |
{ |
|
67 |
return MediaElementVideo; |
|
68 |
} |
|
69 |
set |
|
70 |
{ |
|
71 |
MediaElementVideo= value; |
|
72 |
} |
|
73 |
} |
|
74 |
#endregion |
|
75 |
||
76 |
||
77 |
#region Methodes |
|
3 | 78 |
|
119 | 79 |
public void initPlayer(string path) |
80 |
{ |
|
81 |
//init player |
|
82 |
isPlaying = false; |
|
121
32611257e99f
Link PLayer - SessionInput
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
119
diff
changeset
|
83 |
MediaElementVideo.Source = new Uri(path); |
119 | 84 |
MediaElementVideo.ScrubbingEnabled = true; |
85 |
} |
|
86 |
||
34 | 87 |
public void playerPause() |
88 |
{ |
|
89 |
MediaElementVideo.Pause(); |
|
165 | 90 |
if (PlayerStopOrPause != null) |
168
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
91 |
PlayerStopOrPause(false, new EventArgs()); |
34 | 92 |
} |
93 |
public void playerPlay() |
|
94 |
{ |
|
95 |
MediaElementVideo.Play(); |
|
168
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
96 |
if (PlayerStopOrPause != null) |
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
97 |
PlayerStopOrPause(true, new EventArgs()); |
34 | 98 |
} |
99 |
public void playerStop() |
|
100 |
{ |
|
101 |
MediaElementVideo.Stop(); |
|
165 | 102 |
if (PlayerStopOrPause != null) |
168
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
103 |
PlayerStopOrPause(false, new EventArgs()); |
34 | 104 |
} |
188
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
105 |
|
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
106 |
public void setSound(double val) |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
107 |
{ |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
108 |
if (((MediaElementVideo.Volume + val) < 1) && ((MediaElementVideo.Volume + val) > 0)) |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
109 |
MediaElementVideo.Volume += val; |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
110 |
else if ((MediaElementVideo.Volume + val) > 1) |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
111 |
MediaElementVideo.Volume = 1; |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
112 |
else |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
113 |
MediaElementVideo.Volume = 0; |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
114 |
} |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
115 |
|
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
116 |
public void setMute(bool b) |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
117 |
{ |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
118 |
if (b) MediaElementVideo.IsMuted = true; |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
119 |
else MediaElementVideo.IsMuted = false; |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
174
diff
changeset
|
120 |
} |
34 | 121 |
#endregion |
122 |
||
173
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
123 |
#region GestureEvents |
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
124 |
|
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
125 |
public void GestureDetected(object sender, GestureControl.GestureRoutedEventArgs e) |
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
126 |
{ |
193 | 127 |
|
128 |
/* |
|
129 |
* e.Gesture.Name = Nom de la gesture |
|
130 |
* e.Gesture.Start = Valeur de la timeline au début de l'annotation |
|
131 |
* e.Gesture.End = Valeur de la timeline à la fin de l'annotation |
|
132 |
* |
|
133 |
*/ |
|
134 |
||
135 |
switch (e.Gesture.Name) |
|
173
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
136 |
{ |
189 | 137 |
case "TRIGGER": |
138 |
|
|
139 |
usercontrolInfoUser.LabelSession.Content = "TRIGGER!"; |
|
140 |
break; |
|
141 |
case "CONTRE POINTS": |
|
142 |
||
143 |
usercontrolInfoUser.LabelSession.Content = "CONTRE POINTS!"; |
|
144 |
break; |
|
145 |
case "CONTRE PESANTEUR": |
|
146 |
||
147 |
usercontrolInfoUser.LabelSession.Content = "CONTRE PESANTEUR!"; |
|
148 |
break; |
|
149 |
case "AVEC PESANTEUR": |
|
150 |
||
151 |
usercontrolInfoUser.LabelSession.Content = "AVEC PESANTEUR!"; |
|
152 |
break; |
|
153 |
case "ALIGNEMENT": |
|
154 |
||
155 |
usercontrolInfoUser.LabelSession.Content = "ALIGNEMENT!"; |
|
156 |
break; |
|
157 |
case "CONTACT VISUEL": |
|
158 |
||
159 |
usercontrolInfoUser.LabelSession.Content = "CONTACT VISUEL!"; |
|
160 |
break; |
|
161 |
case "MOUVEMENT CONTRAINTE": |
|
162 |
||
163 |
usercontrolInfoUser.LabelSession.Content = "MOUVEMENT CONTRAINTE!"; |
|
173
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
164 |
break; |
189 | 165 |
case "UN DANSEUR": |
166 |
||
167 |
usercontrolInfoUser.LabelSession.Content = "UN DANSEUR!"; |
|
168 |
break; |
|
169 |
case "DEUX DANSEURS": |
|
170 |
||
171 |
usercontrolInfoUser.LabelSession.Content = "DEUX DANSEURS!"; |
|
172 |
break; |
|
173 |
case "TROIS DANSEURS": |
|
174 |
||
175 |
usercontrolInfoUser.LabelSession.Content = "TROIS DANSEURS!"; |
|
173
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
176 |
break; |
189 | 177 |
case "QUATRE DANSEURS": |
178 |
||
179 |
usercontrolInfoUser.LabelSession.Content = "QUATRE DANSEURS!"; |
|
180 |
break; |
|
181 |
case "TOUS LES DANSEURS": |
|
182 |
||
183 |
usercontrolInfoUser.LabelSession.Content = "TOUS LES DANSEURS!"; |
|
173
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
184 |
break; |
189 | 185 |
case "CONTACT TABLE/DANSEUR": |
186 |
||
187 |
usercontrolInfoUser.LabelSession.Content = "CONTACT TABLE/DANSEUR!"; |
|
188 |
break; |
|
189 |
case "PLAY-PAUSE": |
|
190 |
usercontrolInfoUser.LabelSession.Content = "PLAY-PAUSE!"; |
|
191 |
ButtonPlayPause_ContactDown(null, null); |
|
173
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
192 |
break; |
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
193 |
default: |
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
194 |
break; |
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
195 |
} |
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
196 |
} |
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
197 |
#endregion |
e99fe78cd168
Gesture Control Integration in the Control Player
ARIAS Santiago
parents:
170
diff
changeset
|
198 |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
156
diff
changeset
|
199 |
#region Button Simple Player Actions |
3 | 200 |
private void ButtonPlayPause_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) |
201 |
{ |
|
34 | 202 |
if (!isPlaying)//Play |
3 | 203 |
{ |
34 | 204 |
isPlaying = true; |
3 | 205 |
try |
206 |
{ |
|
207 |
MediaElementVideo.Play(); |
|
168
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
208 |
if (PlayerStopOrPause != null) |
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
209 |
PlayerStopOrPause(true, new EventArgs()); |
3 | 210 |
} |
211 |
catch (Exception ex) { } |
|
212 |
} |
|
213 |
else//Pause |
|
214 |
{ |
|
34 | 215 |
isPlaying = false; |
3 | 216 |
try |
217 |
{ |
|
218 |
MediaElementVideo.Pause(); |
|
168
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
219 |
if (PlayerStopOrPause != null) |
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
220 |
PlayerStopOrPause(false, new EventArgs()); |
3 | 221 |
} |
34 | 222 |
catch (Exception exx) { } |
3 | 223 |
} |
224 |
||
225 |
} |
|
226 |
||
193 | 227 |
/* |
228 |
|
|
3 | 229 |
private void ButtonPlayPause_Click(object sender, RoutedEventArgs e) |
230 |
{ |
|
34 | 231 |
if (!isPlaying)//Play |
3 | 232 |
{ |
34 | 233 |
isPlaying = true; |
3 | 234 |
try |
235 |
{ |
|
236 |
MediaElementVideo.Play(); |
|
168
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
237 |
if (PlayerStopOrPause != null) |
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
238 |
PlayerStopOrPause(true, new EventArgs()); |
3 | 239 |
} |
34 | 240 |
catch (Exception ex) { } |
241 |
||
3 | 242 |
} |
243 |
else//Pause |
|
244 |
{ |
|
34 | 245 |
isPlaying = false; |
3 | 246 |
try |
247 |
{ |
|
248 |
MediaElementVideo.Pause(); |
|
168
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
249 |
if (PlayerStopOrPause != null) |
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
250 |
PlayerStopOrPause(false, new EventArgs()); |
3 | 251 |
} |
34 | 252 |
catch (Exception exx) { } |
253 |
//ButtonPlayPause.Background = FindResource("[Skin_1]_Play_button_xaml") as Brush; |
|
254 |
} |
|
255 |
} |
|
256 |
||
257 |
private void ButtonFastForward_Click(object sender, RoutedEventArgs e) |
|
258 |
{ |
|
259 |
if (MediaElementVideo.SpeedRatio <= 3) |
|
260 |
MediaElementVideo.SpeedRatio += 1; |
|
261 |
} |
|
262 |
||
263 |
private void ButtonFastForward_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) |
|
264 |
{ |
|
265 |
if (MediaElementVideo.SpeedRatio <= 3) |
|
266 |
MediaElementVideo.SpeedRatio += 1; |
|
267 |
} |
|
268 |
||
269 |
private void ButtonRewind_Click(object sender, RoutedEventArgs e) |
|
270 |
{ |
|
271 |
//TimeSpan ts = new TimeSpan(0, 0, 0, 0); |
|
272 |
if (MediaElementVideo.SpeedRatio > 1) |
|
273 |
{ |
|
274 |
MediaElementVideo.SpeedRatio -= 1; |
|
3 | 275 |
} |
34 | 276 |
else |
277 |
{ |
|
278 |
MediaElementVideo.Position = MediaElementVideo.Position.Add(new TimeSpan(0, 0, 0, -5)); |
|
279 |
} |
|
280 |
} |
|
281 |
||
282 |
private void ButtonRewind_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) |
|
283 |
{ |
|
284 |
||
285 |
//TimeSpan ts = new TimeSpan(0, 0, 0,0); |
|
286 |
if (MediaElementVideo.SpeedRatio > 1) |
|
287 |
{ |
|
288 |
MediaElementVideo.SpeedRatio -= 1; |
|
289 |
} |
|
290 |
else |
|
291 |
{ |
|
292 |
MediaElementVideo.Position = MediaElementVideo.Position.Add(new TimeSpan(0, 0, 0, -5)); |
|
293 |
} |
|
294 |
} |
|
193 | 295 |
|
296 |
*/ |
|
34 | 297 |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
156
diff
changeset
|
298 |
#endregion |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
156
diff
changeset
|
299 |
|
34 | 300 |
private void MediaElementVideo_MediaOpened(object sender, RoutedEventArgs e) |
301 |
{ |
|
302 |
OnPlayerOpened(); |
|
303 |
} |
|
304 |
protected virtual void OnPlayerOpened() |
|
305 |
{ |
|
306 |
if(PlayerOpened!=null) |
|
307 |
PlayerOpened(this, new EventArgs()); |
|
3 | 308 |
} |
143 | 309 |
|
310 |
private void Play_Pause_area_DragEnter(object sender, SurfaceDragDropEventArgs e) |
|
311 |
{ |
|
312 |
//Console.WriteLine("Enter"); |
|
313 |
||
314 |
// If the TimelineAnnotationView comes from a user control different from the current one, |
|
315 |
// it means that we want to add the annotation to the current list. |
|
316 |
// So we check if the dragged annotation can be dragged or if it will recover any existant annotation (in this case it will not be accepted) |
|
317 |
// e.Cursor.DragSource is the SurfaceListBox where the drag started from |
|
318 |
SurfaceListBox slb = (SurfaceListBox)e.Cursor.DragSource; |
|
319 |
// We get the instance of the UserControlSyncSource |
|
320 |
UserControl syncSrc = (UserControl)((Grid)((Grid)this.Parent).Parent).Parent; |
|
321 |
// and its UserControlTimeline |
|
322 |
UserControlTimeLine tl = (UserControlTimeLine)((Grid)((Grid)syncSrc.Content).Children[0]).Children[0]; |
|
323 |
if (((Grid)((UserControl)((Grid)slb.Parent).Parent).Parent).Parent != tl) |
|
324 |
{ |
|
325 |
// e.Cursor.Visual is the ContentControl, so its Content is the dragged TimelineAnnotationView |
|
326 |
AnnotationViewModel annotationDataVM = (AnnotationViewModel)((TimelineAnnotationView)((ContentControl)e.Cursor.Visual).Content).DataContext; |
|
193 | 327 |
//Play_Pause_area.Background = tl.isAnnotationAccepted(annotationDataVM) ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red); |
143 | 328 |
} |
329 |
else |
|
330 |
{ |
|
193 | 331 |
//Play_Pause_area.Background = new SolidColorBrush(Colors.White); |
143 | 332 |
} |
193 | 333 |
//Play_Pause_area.Opacity = 0.3; |
143 | 334 |
|
335 |
} |
|
336 |
||
337 |
private void Play_Pause_area_DragLeave(object sender, SurfaceDragDropEventArgs e) |
|
338 |
{ |
|
339 |
//Console.WriteLine("Leave"); |
|
193 | 340 |
//Play_Pause_area.Opacity = 0; |
143 | 341 |
} |
342 |
||
343 |
private void Play_Pause_area_DragOver(object sender, SurfaceDragDropEventArgs e) |
|
344 |
{ |
|
345 |
//Console.WriteLine("Over"); |
|
346 |
} |
|
347 |
||
348 |
private void Play_Pause_area_Drop(object sender, SurfaceDragDropEventArgs e) |
|
349 |
{ |
|
350 |
//Console.WriteLine("Drop"); |
|
193 | 351 |
//Play_Pause_area.Opacity = 0; |
143 | 352 |
// e.Cursor.Visual is the ContentControl, so its Content is the dragged TimelineAnnotationView |
353 |
AnnotationViewModel annotationDataVM = (AnnotationViewModel)((TimelineAnnotationView)((ContentControl)e.Cursor.Visual).Content).DataContext; |
|
354 |
int nbSeconds = (int)annotationDataVM.TcBegin; |
|
355 |
int nbMilliSec = (int)((annotationDataVM.TcBegin * 1000)%1000); |
|
356 |
MediaElementVideo.Position = new TimeSpan(0, 0, 0, nbSeconds, nbMilliSec); |
|
357 |
||
358 |
||
359 |
// If the TimelineAnnotationView comes from a user control different from the current one, |
|
360 |
// it means that we want to add the annotation to the current list. |
|
361 |
// So we generate the ActionAddAnnotation |
|
362 |
// e.Cursor.DragSource is the SurfaceListBox where the drag started from |
|
363 |
SurfaceListBox slb = (SurfaceListBox)e.Cursor.DragSource; |
|
364 |
// We get the instance of the UserControlSyncSource |
|
365 |
UserControl syncSrc = (UserControl)((Grid)((Grid)this.Parent).Parent).Parent; |
|
366 |
// and its UserControlTimeline |
|
367 |
UserControl tl = (UserControl)((Grid)((Grid)syncSrc.Content).Children[0]).Children[0]; |
|
368 |
if (((Grid)((UserControl)((Grid)slb.Parent).Parent).Parent).Parent != tl) |
|
369 |
{ |
|
370 |
// Now we build the action arguments : a list holding the timeline and the annotation view models |
|
371 |
List<Object> actionsArgs = new List<Object>(); |
|
372 |
actionsArgs.Add(tl); |
|
373 |
actionsArgs.Add(annotationDataVM); |
|
374 |
||
375 |
ActionGenerator ag = new ActionGenerator(); |
|
376 |
ActionBase ab = ag.GetAction("ActionAddAnnotation", actionsArgs); |
|
377 |
if (ab != null) |
|
378 |
ab.Execute(); |
|
379 |
} |
|
380 |
||
381 |
} |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
156
diff
changeset
|
382 |
|
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
156
diff
changeset
|
383 |
//This function Sets a brush in a specific rectangle of the StackPanelAnnotation |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
156
diff
changeset
|
384 |
public void displayStackPanelAnnotations(int id, Brush brushAnnotation) |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
156
diff
changeset
|
385 |
{ |
163 | 386 |
Object o = null; |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
156
diff
changeset
|
387 |
switch (id) |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
156
diff
changeset
|
388 |
{ |
163 | 389 |
case 1: |
390 |
rect1.Fill = brushAnnotation; |
|
391 |
o = rect1.FindResource("Rect1Annotation"); |
|
392 |
rect1.BeginStoryboard((Storyboard)o); |
|
393 |
break; |
|
394 |
case 2: rect2.Fill = brushAnnotation; |
|
395 |
o = rect2.FindResource("Rect2Annotation"); |
|
396 |
rect2.BeginStoryboard((Storyboard)o); |
|
397 |
break; |
|
398 |
case 3: rect3.Fill = brushAnnotation; |
|
399 |
o = rect3.FindResource("Rect3Annotation"); |
|
400 |
rect3.BeginStoryboard((Storyboard)o); |
|
401 |
break; |
|
402 |
case 4: rect4.Fill = brushAnnotation; |
|
403 |
o = rect4.FindResource("Rect4Annotation"); |
|
404 |
rect4.BeginStoryboard((Storyboard)o); |
|
405 |
break; |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
156
diff
changeset
|
406 |
default: break; |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
156
diff
changeset
|
407 |
} |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
156
diff
changeset
|
408 |
} |
3 | 409 |
} |
410 |
} |