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