equal
deleted
inserted
replaced
34 public event EventHandler DragStarted; |
34 public event EventHandler DragStarted; |
35 public event EventHandler DragCompleted; |
35 public event EventHandler DragCompleted; |
36 public event EventHandler TimerTick; |
36 public event EventHandler TimerTick; |
37 public event EventHandler AnnotationAdded; |
37 public event EventHandler AnnotationAdded; |
38 public event EventHandler AnnotationRemoved; |
38 public event EventHandler AnnotationRemoved; |
|
39 public event EventHandler<NewGestureRecognizedEventArg> NewGestureRecognized; |
39 //SAR |
40 //SAR |
40 public event EventHandler OnSuccessAnnotation; |
41 public event EventHandler OnSuccessAnnotation; |
41 //ENDSAR |
42 //ENDSAR |
42 |
43 |
43 private double totalmilliseconds; |
44 private double totalmilliseconds; |
299 if (annotOk) |
300 if (annotOk) |
300 OnSuccessAnnotation(this, new EventArgs()); |
301 OnSuccessAnnotation(this, new EventArgs()); |
301 |
302 |
302 } |
303 } |
303 |
304 |
|
305 public void addAnnotation(float start, float dur, String gestureType) |
|
306 { |
|
307 addAnnotation(new AnnotationViewModel(new Annotation("temp", start, dur, gestureType, CurrentColor), 0)); |
|
308 } |
|
309 |
304 public void startOrEndAnnotation(String gestureType) |
310 public void startOrEndAnnotation(String gestureType) |
305 { |
311 { |
306 Boolean annotOk = true; |
312 Boolean annotOk = true; |
307 // We open a new annotation |
313 // We open a new annotation |
308 if (cut != null && AnnotWaiting == false) |
314 if (cut != null && AnnotWaiting == false) |
357 } |
363 } |
358 //Raise Event to display Annotation in all Openned UserPanels |
364 //Raise Event to display Annotation in all Openned UserPanels |
359 if (annotOk) |
365 if (annotOk) |
360 OnSuccessAnnotation(this, new EventArgs()); |
366 OnSuccessAnnotation(this, new EventArgs()); |
361 } |
367 } |
362 } |
|
363 |
|
364 |
|
365 public void UserControlPlayer_NewGestureRegognized(object sender, EventArgs e) |
|
366 { |
|
367 try |
|
368 { |
|
369 GestureEventArg grea = (GestureEventArg)e; |
|
370 //Console.WriteLine("Timeline NewGestureRegognized " + grea.Gesture.Name + ", " + grea.Gesture.Start + ", " + grea.Gesture.End); |
|
371 // If the stroke has been drawed very fast, end and start can be the same, so we add a little length. |
|
372 float dur = (float)(grea.End - grea.Start); |
|
373 if (dur == 0) dur = (float)0.5; |
|
374 foreach(Gesture elt in grea.Gestures) |
|
375 addAnnotation(new AnnotationViewModel(new Annotation("temp", (float)grea.Start, (float)(grea.End - grea.Start), elt.Name, CurrentColor), 0)); |
|
376 } |
|
377 catch { } |
|
378 } |
368 } |
379 |
369 |
380 private void listview_PreviewContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) |
370 private void listview_PreviewContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) |
381 { |
371 { |
382 FrameworkElement findSource = e.OriginalSource as FrameworkElement; |
372 FrameworkElement findSource = e.OriginalSource as FrameworkElement; |
483 } |
473 } |
484 confirmCancelPopup.Visibility = Visibility.Hidden; |
474 confirmCancelPopup.Visibility = Visibility.Hidden; |
485 canceledAnnotationVM = null; |
475 canceledAnnotationVM = null; |
486 } |
476 } |
487 |
477 |
|
478 // |
|
479 // Is search mode, function of the search gesture, we have to be able to update frequently the current list of annotation |
|
480 // |
|
481 public void updateAnnotationList(List<Annotation> la) |
|
482 { |
|
483 tv.DataContext = new CuttingViewModel(new Cutting("temp", "search", la), AnnotWidth, tv.ScaleX); |
|
484 } |
|
485 |
|
486 // |
|
487 // Is search mode, we need the timeline to send the NewGestureEvent |
|
488 // |
|
489 public void sendNewGesture(String gestureName) |
|
490 { |
|
491 NewGestureRecognized(this, new NewGestureRecognizedEventArg(gestureName)); |
|
492 } |
|
493 |
488 |
494 |
489 } |
495 } |
|
496 |
|
497 |
|
498 /// <summary> |
|
499 /// AnnotationOrSearchEventArg |
|
500 /// </summary> |
|
501 public class NewGestureRecognizedEventArg : EventArgs |
|
502 { |
|
503 public String GestureName |
|
504 { |
|
505 get; |
|
506 set; |
|
507 } |
|
508 |
|
509 public NewGestureRecognizedEventArg(String gestureName) |
|
510 { |
|
511 |
|
512 GestureName = gestureName; |
|
513 |
|
514 } |
|
515 } |
490 } |
516 } |