src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs
author cavaliet
Wed, 25 Nov 2009 10:49:44 +0100
changeset 231 4eff6b0c9215
parent 229 05aba5def1fc
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
     1
using System;
69
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 34
diff changeset
     2
using System.Collections.Generic;
10
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
     3
using System.IO;
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
     4
using System.Net;
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
     5
using System.Windows;
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
     6
using System.Windows.Controls;
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
     7
using System.Windows.Data;
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
     8
using System.Windows.Input;
10
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
     9
using System.Windows.Media;
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
    10
using System.Windows.Media.Animation;
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
    11
using System.Windows.Navigation;
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    12
using System.Windows.Controls.Primitives;
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
    13
using Microsoft.Surface.Presentation;
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    14
using Microsoft.Surface.Presentation.Controls;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    15
using System.Windows.Threading;
10
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
    16
69
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 34
diff changeset
    17
using FingersDance.Data;
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 34
diff changeset
    18
using FingersDance.ViewModels;
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
    19
using FingersDance.Views;
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
    20
using FingersDance.Control.Close;
203
2948b34324bb first step of adding annotation from a recognised gesture.
cavaliet
parents: 196
diff changeset
    21
using GestureControl;
69
a4c44555f205 First Data binding for annotations and timeline
cavaliet
parents: 34
diff changeset
    22
10
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
    23
namespace FingersDance.Control.TimeLine
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
    24
{
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
    25
	public partial class UserControlTimeLine
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    26
    {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    27
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    28
        #region Variables
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    29
        private DispatcherTimer timer;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    30
        private bool isDragging = false;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    31
        private bool finishedDragging = false;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    32
        #endregion
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
    33
        
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    34
        public event EventHandler DragStarted;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    35
        public event EventHandler DragCompleted;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    36
        public event EventHandler TimerTick;
195
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 194
diff changeset
    37
        public event EventHandler AnnotationAdded;
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 194
diff changeset
    38
        public event EventHandler AnnotationRemoved;
216
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
    39
        public event EventHandler<NewGestureRecognizedEventArg> NewGestureRecognized;
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    40
        //SAR
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    41
        public event EventHandler OnSuccessAnnotation;
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    42
        //ENDSAR
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    43
124
14b058fc64fc Modify TimelineView's scale on resize event
cavaliet
parents: 115
diff changeset
    44
        private double totalmilliseconds;
160
e940ca798fe3 Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents: 150
diff changeset
    45
        
226
c0661ecf943e debug visual bug for "too far" annotation and simplify gesture handler in player.
cavaliet
parents: 225
diff changeset
    46
        private float AnnotWidth = 1600 + 15; // The surfaceListBox adds 15 pixels between each item
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
    47
        private Cutting cut;
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
    48
        private Boolean AnnotWaiting = false;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
    49
        private float AnnotTcBegin;
160
e940ca798fe3 Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents: 150
diff changeset
    50
        private Color CurrentColor;
74
7ce946833eae First step of data binding where we can add an annotation by clicking on the timeline
cavaliet
parents: 69
diff changeset
    51
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
    52
        private AnnotationViewModel canceledAnnotationVM;
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
    53
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    54
        #region Properties
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    55
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    56
        public SurfaceSlider Slider
10
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
    57
        {
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    58
            get
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    59
            {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    60
                return slider;
10
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
    61
            }
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    62
            set
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    63
            {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    64
                slider = value;
10
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
    65
            }
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
    66
        }
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
    67
        
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    68
        public bool IsDragging
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    69
        {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    70
            get
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    71
            {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    72
                return isDragging;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    73
            }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    74
            set
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    75
            {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    76
                isDragging = value;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    77
            }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    78
        }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    79
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    80
        public bool FinishedDragging
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    81
        {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    82
            get
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    83
            {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    84
                return finishedDragging;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    85
            }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    86
            set
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    87
            {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    88
                finishedDragging = value;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    89
            }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    90
        }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    91
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    92
        public DispatcherTimer Timer
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    93
        {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    94
            get
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    95
            {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    96
                return timer;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    97
            }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    98
            set
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
    99
            {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   100
                timer = value;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   101
            }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   102
        }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   103
        #endregion
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   104
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   105
168
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   106
        #region Constructors
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   107
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   108
        public UserControlTimeLine()
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   109
		{
10
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
   110
			this.InitializeComponent();
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   111
            
10
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
   112
			// Insert code required on object creation below this point.
168
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   113
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   114
        }
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   115
        #endregion
10
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
   116
124
14b058fc64fc Modify TimelineView's scale on resize event
cavaliet
parents: 115
diff changeset
   117
        public void initslider(double totalmillisecondsPar)
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   118
        {
124
14b058fc64fc Modify TimelineView's scale on resize event
cavaliet
parents: 115
diff changeset
   119
            totalmilliseconds = totalmillisecondsPar;
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   120
            slider.Maximum = totalmilliseconds;
124
14b058fc64fc Modify TimelineView's scale on resize event
cavaliet
parents: 115
diff changeset
   121
            // When the timeline is resized, we catch the resize event to define TimelineView's good scale
14b058fc64fc Modify TimelineView's scale on resize event
cavaliet
parents: 115
diff changeset
   122
            this.SizeChanged += new SizeChangedEventHandler(UserControlTimeLine_SizeChanged);
167
206f07a8d887 Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents: 166
diff changeset
   123
            
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   124
            tv.listview.PreviewContactDown += listview_PreviewContactDown;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   125
            SurfaceDragDrop.AddDragCanceledHandler(tv.listview, onDragCanceled);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   126
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   127
            UserControlTimeLine_SizeChanged(null, null);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   128
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   129
            slider_ContactTapGesture(this, null);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   130
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   131
        }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   132
124
14b058fc64fc Modify TimelineView's scale on resize event
cavaliet
parents: 115
diff changeset
   133
        void UserControlTimeLine_SizeChanged(object sender, SizeChangedEventArgs e)
14b058fc64fc Modify TimelineView's scale on resize event
cavaliet
parents: 115
diff changeset
   134
        {
14b058fc64fc Modify TimelineView's scale on resize event
cavaliet
parents: 115
diff changeset
   135
            // When scaleX = 1, 1 second = 1 pixel. To calculate the new scale, we take the real width in account.
167
206f07a8d887 Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents: 166
diff changeset
   136
            tv.ScaleX = (this.ActualWidth-30) / (totalmilliseconds / 1000);
160
e940ca798fe3 Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents: 150
diff changeset
   137
            //tv.Width = this.ActualWidth - 30;
124
14b058fc64fc Modify TimelineView's scale on resize event
cavaliet
parents: 115
diff changeset
   138
            
14b058fc64fc Modify TimelineView's scale on resize event
cavaliet
parents: 115
diff changeset
   139
        }
14b058fc64fc Modify TimelineView's scale on resize event
cavaliet
parents: 115
diff changeset
   140
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   141
        #region Timer
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 226
diff changeset
   142
        public void initTimer(Cutting cutPar)
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   143
        {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   144
            timer = new DispatcherTimer();
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   145
            timer.Interval = new TimeSpan(0, 0, 0, 0, 100);
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   146
            timer.Tick += new EventHandler(timer_Tick);
150
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 146
diff changeset
   147
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 226
diff changeset
   148
            if(cutPar!=null)
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 226
diff changeset
   149
                CurrentColor = cutPar.Color;
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   150
160
e940ca798fe3 Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents: 150
diff changeset
   151
            // DATA BINDING from the cutting sent in parameter (initialised before by the userPanel with the global project)
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   152
            cut = cutPar;
192
11083c390ce4 Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents: 190
diff changeset
   153
            //cut.AnnotList = new List<Annotation>();
11083c390ce4 Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents: 190
diff changeset
   154
            //cut.AnnotList.Add(new Annotation("s_" + System.Guid.NewGuid(), 0, 10, "Axe Cam 1", CurrentColor));
11083c390ce4 Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents: 190
diff changeset
   155
            //cut.AnnotList.Add(new Annotation("s_" + System.Guid.NewGuid(), 100 - (1 * AnnotWidth), 70, "Mvt Cam 2"));
11083c390ce4 Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents: 190
diff changeset
   156
            //cut.AnnotList.Add(new Annotation("s_" + System.Guid.NewGuid(), 200 - (2 * AnnotWidth), 50, "Saut 3"));
11083c390ce4 Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents: 190
diff changeset
   157
            //cut.AnnotList.Add(new Annotation("s_" + System.Guid.NewGuid(), 100 - (3 * AnnotWidth), 20, "Saut 4"));
11083c390ce4 Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents: 190
diff changeset
   158
            //cut.AnnotList.Add(new Annotation("s_" + System.Guid.NewGuid(), 120 - (4 * AnnotWidth), 50, "Saut 5"));
11083c390ce4 Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents: 190
diff changeset
   159
211
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 207
diff changeset
   160
            if(cut!=null)
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 207
diff changeset
   161
                tv.DataContext = new CuttingViewModel(cut, AnnotWidth);
160
e940ca798fe3 Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents: 150
diff changeset
   162
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   163
        }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   164
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   165
        public void timerStart()
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   166
        {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   167
            if (timer != null)
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   168
                timer.Start();
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   169
        }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   170
        void timer_Tick(object sender, EventArgs e)
10
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
   171
        {
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   172
            OnTimerTick();
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   173
            if (!isDragging)
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   174
            {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   175
                //slider.Value = media.Position.TotalMilliseconds;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   176
            }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   177
            if (finishedDragging)
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   178
            {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   179
                //int SliderValue = (int)slider.Value;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   180
                //TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue);
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   181
               // media.Position = ts;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   182
               // media.Play();
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   183
               // isDragging = false;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   184
                //finishedDragging = false;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   185
            }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   186
        }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   187
        protected virtual void OnTimerTick()
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   188
        {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   189
            if (TimerTick != null)
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   190
                TimerTick(this, new EventArgs());
10
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
   191
        }
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   192
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   193
        #endregion
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   194
160
e940ca798fe3 Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents: 150
diff changeset
   195
        #region SliderDrag
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   196
        private void sliderPosition_DragStarted(object sender, DragStartedEventArgs e)
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   197
        {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   198
            isDragging = true;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   199
            OnDragStarted();
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   200
           // media.Pause();
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   201
        }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   202
        protected virtual void OnDragStarted()
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   203
        {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   204
            if (DragStarted != null)
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   205
                DragStarted(this, new EventArgs());
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   206
        }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   207
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   208
        private void sliderPosition_DragCompleted(object sender, DragCompletedEventArgs e)
34
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   209
        {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   210
            finishedDragging = true;
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   211
            OnDragCompleted();
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   212
        }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   213
        protected virtual void OnDragCompleted()
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   214
        {
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   215
            if (DragCompleted != null)
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   216
                DragCompleted(this, new EventArgs());
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   217
        }
9e222810f5b5 User Control Player
sarias
parents: 10
diff changeset
   218
74
7ce946833eae First step of data binding where we can add an annotation by clicking on the timeline
cavaliet
parents: 69
diff changeset
   219
        private void slider_ContactTapGesture(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
7ce946833eae First step of data binding where we can add an annotation by clicking on the timeline
cavaliet
parents: 69
diff changeset
   220
        {
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   221
            //startOrEndAnnotation();
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   222
        }
160
e940ca798fe3 Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents: 150
diff changeset
   223
        #endregion
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   224
168
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   225
        public void thumbRotation(bool isplaying)
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   226
        { 
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   227
            //Templateslider.Style.Setters["Template"]
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   228
            if(isplaying)
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   229
                slider.Style = FindResource("FingersDance.Control.Slider") as Style;
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   230
            else
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   231
                slider.Style = FindResource("SurfaceSliderStylePause") as Style;
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   232
        }
203
2948b34324bb first step of adding annotation from a recognised gesture.
cavaliet
parents: 196
diff changeset
   233
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   234
        public Boolean isAnnotationAccepted(AnnotationViewModel avm)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   235
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   236
            Boolean annotOk = true;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   237
            // We check if the annotation's begin and end timecodes allow a new annotation creation
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   238
            if (cut != null && AnnotWaiting == false)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   239
            {
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   240
                foreach (Annotation a in cut.AnnotList)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   241
                {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   242
                    //Console.WriteLine("a.TcBegin = " + a.TcBegin + ", avm.TcBegin = " + avm.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur));
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   243
                    // Check begin TC
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   244
                    if (a.TcBegin <= avm.TcBegin && avm.TcBegin <= (a.TcBegin + a.Dur))
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   245
                    {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   246
                        annotOk = false;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   247
                    }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   248
                    // Check end tc and if the new annotation will not cover any other
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   249
                    float endTC = avm.TcBegin + avm.Dur;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   250
                    //Console.WriteLine("a.TcBegin = " + a.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur) + ", AnnotTcBegin = " + AnnotTcBegin + ", currentTC = " + currentTC);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   251
                    if (a.TcBegin <= endTC && endTC <= (a.TcBegin + a.Dur) || (avm.TcBegin < a.TcBegin && (a.TcBegin + a.Dur) < endTC))
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   252
                    {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   253
                        annotOk = false;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   254
                    }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   255
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   256
            }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   257
            else
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   258
            {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   259
                annotOk = false;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   260
            }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   261
            return annotOk;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   262
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 74
diff changeset
   263
        }
74
7ce946833eae First step of data binding where we can add an annotation by clicking on the timeline
cavaliet
parents: 69
diff changeset
   264
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   265
        public void addAnnotation(AnnotationViewModel avm)
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 74
diff changeset
   266
        {
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   267
            //Console.WriteLine("addAnnotation = " + avm.TcBegin + ", " + avm.Dur + ", " + avm.GestureType);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   268
            Boolean annotOk = true;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   269
            // We check if the annotation's begin and end timecodes allow a new annotation creation
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   270
            if (cut != null && AnnotWaiting == false)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   271
            {
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   272
                foreach (Annotation a in cut.AnnotList)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   273
                {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   274
                    //Console.WriteLine("a.TcBegin = " + a.TcBegin + ", avm.TcBegin = " + avm.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur));
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   275
                    // Check begin TC
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   276
                    if (a.TcBegin <= avm.TcBegin && avm.TcBegin <= (a.TcBegin + a.Dur))
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   277
                    {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   278
                        annotOk = false;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   279
                    }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   280
                    // Check end tc and if the new annotation will not cover any other
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   281
                    float endTC = avm.TcBegin + avm.Dur;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   282
                    //Console.WriteLine("a.TcBegin = " + a.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur) + ", AnnotTcBegin = " + AnnotTcBegin + ", currentTC = " + currentTC);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   283
                    if (a.TcBegin <= endTC && endTC <= (a.TcBegin + a.Dur) || (avm.TcBegin < a.TcBegin && (a.TcBegin + a.Dur) < endTC))
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   284
                    {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   285
                        annotOk = false;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   286
                    }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   287
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   288
                // If everything's fine, we create the new one
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   289
                if (annotOk == true)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   290
                {
195
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 194
diff changeset
   291
                    Annotation annotation = new Annotation("s_" + System.Guid.NewGuid(), avm.TcBegin, avm.Dur, avm.GestureType, avm.Color);
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 194
diff changeset
   292
                    cut.AnnotList.Add(annotation);
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   293
                    tv.DataContext = new CuttingViewModel(cut, AnnotWidth, tv.ScaleX);
195
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 194
diff changeset
   294
                    if (AnnotationAdded != null)
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 194
diff changeset
   295
                        AnnotationAdded(annotation, null);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   296
                    AnnotWaiting = false;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   297
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   298
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   299
            }
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   300
            //Raise Event to display Annotation in all Openned UserPanels
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   301
            if (annotOk)
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   302
                OnSuccessAnnotation(this, new EventArgs());
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   303
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   304
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   305
225
b60e13ed75c8 Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
cavaliet
parents: 224
diff changeset
   306
        public void addAnnotation(float start, float dur, List<String> gestureType)
216
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   307
        {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   308
            addAnnotation(new AnnotationViewModel(new Annotation("temp", start, dur, gestureType, CurrentColor), 0));
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   309
        }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   310
194
d96cd2bce653 gesture passed as parameter from the menu
cavaliet
parents: 192
diff changeset
   311
        public void startOrEndAnnotation(String gestureType)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   312
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   313
            Boolean annotOk = true;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   314
            // We open a new annotation
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   315
            if (cut != null && AnnotWaiting == false)
124
14b058fc64fc Modify TimelineView's scale on resize event
cavaliet
parents: 115
diff changeset
   316
            {
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   317
                AnnotTcBegin = (float)slider.Value / 1000;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   318
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   319
                // First we check if the new annotation will not cover any
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   320
                foreach (Annotation a in cut.AnnotList)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   321
                {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   322
                    //Console.WriteLine("a.TcBegin = " + a.TcBegin + ", AnnotTcBegin = " + AnnotTcBegin + ", tcOut = " + (a.TcBegin + a.Dur));
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   323
                    if (a.TcBegin <= AnnotTcBegin && AnnotTcBegin <= (a.TcBegin + a.Dur))
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   324
                    {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   325
                        annotOk = false;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   326
                    }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   327
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   328
                // if not, we mark the beginning
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   329
                if (annotOk == true)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   330
                {
225
b60e13ed75c8 Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
cavaliet
parents: 224
diff changeset
   331
                    List<String> ls = new List<String>();
b60e13ed75c8 Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
cavaliet
parents: 224
diff changeset
   332
                    ls.Add(gestureType);
b60e13ed75c8 Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
cavaliet
parents: 224
diff changeset
   333
                    Annotation annotation = new Annotation("s_" + System.Guid.NewGuid(), AnnotTcBegin, 0, ls, CurrentColor);
195
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 194
diff changeset
   334
                    cut.AnnotList.Add(annotation);
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   335
                    tv.DataContext = new CuttingViewModel(cut, AnnotWidth, tv.ScaleX);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   336
                    AnnotWaiting = true;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   337
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   338
            }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   339
            // We close the current opened annotation...
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   340
            else if (cut != null && AnnotWaiting == true && (((float)slider.Value/1000)>AnnotTcBegin))
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   341
            {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   342
                // ... by setting setting the good beginning and the good duration
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   343
                float currentTC = (float)slider.Value / 1000;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   344
                float currentDuration = currentTC - AnnotTcBegin;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   345
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   346
                // First we check if the new annotation will not cover any (AnnotTcBegin was already checked)
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   347
                foreach (Annotation a in cut.AnnotList)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   348
                {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   349
                    //Console.WriteLine("a.TcBegin = " + a.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur) + ", AnnotTcBegin = " + AnnotTcBegin + ", currentTC = " + currentTC);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   350
                    if (a.TcBegin <= currentTC && currentTC <= (a.TcBegin + a.Dur) || (AnnotTcBegin < a.TcBegin && (a.TcBegin + a.Dur) < currentTC))
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   351
                    {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   352
                        annotOk = false;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   353
                    }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   354
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   355
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   356
                if (annotOk == true)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   357
                {
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   358
                    cut.AnnotList.RemoveAt(cut.AnnotList.Count - 1);
225
b60e13ed75c8 Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
cavaliet
parents: 224
diff changeset
   359
                    List<String> ls = new List<String>();
b60e13ed75c8 Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
cavaliet
parents: 224
diff changeset
   360
                    ls.Add(gestureType);
b60e13ed75c8 Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
cavaliet
parents: 224
diff changeset
   361
                    Annotation annotation = new Annotation("s_" + System.Guid.NewGuid(), AnnotTcBegin, currentDuration, ls, CurrentColor);
195
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 194
diff changeset
   362
                    cut.AnnotList.Add(annotation);
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   363
                    //Console.WriteLine("currentTimecode = " + AnnotTcBegin + ", curDur = " + currentDuration + ", nb = " + cut.AnnotList.Count + ", res = " + (AnnotTcBegin - (cut.AnnotList.Count * AnnotWidth)));
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   364
                    tv.DataContext = new CuttingViewModel(cut, AnnotWidth, tv.ScaleX);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   365
                    AnnotWaiting = false;
195
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 194
diff changeset
   366
                    if (AnnotationAdded != null)
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 194
diff changeset
   367
                        AnnotationAdded(annotation, null);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   368
                }
167
206f07a8d887 Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents: 166
diff changeset
   369
                //Raise Event to display Annotation in all Openned UserPanels
206f07a8d887 Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents: 166
diff changeset
   370
                if (annotOk)
206f07a8d887 Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents: 166
diff changeset
   371
                    OnSuccessAnnotation(this, new EventArgs());
124
14b058fc64fc Modify TimelineView's scale on resize event
cavaliet
parents: 115
diff changeset
   372
            }
74
7ce946833eae First step of data binding where we can add an annotation by clicking on the timeline
cavaliet
parents: 69
diff changeset
   373
        }
7ce946833eae First step of data binding where we can add an annotation by clicking on the timeline
cavaliet
parents: 69
diff changeset
   374
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   375
        private void listview_PreviewContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   376
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   377
            FrameworkElement findSource = e.OriginalSource as FrameworkElement;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   378
            SurfaceListBoxItem draggedElement = null;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   379
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   380
            // Find the touched SurfaceListBoxItem object.
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   381
            while (draggedElement == null && findSource != null)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   382
            {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   383
                if ((draggedElement = findSource as SurfaceListBoxItem) == null)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   384
                {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   385
                    findSource = VisualTreeHelper.GetParent(findSource) as FrameworkElement;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   386
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   387
            }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   388
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   389
            if (draggedElement == null)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   390
            {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   391
                return;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   392
            }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   393
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   394
            // Create the cursor visual.
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   395
            ContentControl cursorVisual = new ContentControl()
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   396
            {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   397
                Content = new TimelineAnnotationView()
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   398
                {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   399
                    DataContext = findSource.DataContext
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   400
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   401
            };
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   402
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   403
            // We apply the current scale to the dragged annotation
166
33c2e634df13 update drag and drop for dragged annotation to be well displayed and avoid DnD problems
cavaliet
parents: 162
diff changeset
   404
            ((TimelineAnnotationView)cursorVisual.Content).RenderTransform = new TransformGroup();
33c2e634df13 update drag and drop for dragged annotation to be well displayed and avoid DnD problems
cavaliet
parents: 162
diff changeset
   405
            ((TransformGroup)((TimelineAnnotationView)cursorVisual.Content).RenderTransform).Children.Add(tv.listview.RenderTransform);
167
206f07a8d887 Annotation's scale is now still visually at one, whatever the timeline's scale.
cavaliet
parents: 166
diff changeset
   406
            // We apply a translate transform to place correctly the dragged annotation
166
33c2e634df13 update drag and drop for dragged annotation to be well displayed and avoid DnD problems
cavaliet
parents: 162
diff changeset
   407
            ((TransformGroup)((TimelineAnnotationView)cursorVisual.Content).RenderTransform).Children.Add(new TranslateTransform((AnnotWidth / 2) * (1 - ((ScaleTransform)tv.listview.RenderTransform).ScaleX), 0));
33c2e634df13 update drag and drop for dragged annotation to be well displayed and avoid DnD problems
cavaliet
parents: 162
diff changeset
   408
            
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   409
            // Add a handler. This will enable the application to change the visual cues. (NOT USEFUL IN FINGERSDANCE CASE)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   410
            //SurfaceDragDrop.AddTargetChangedHandler(cursorVisual, OnTargetChanged);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   411
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   412
            // Create a list of input devices. Add the contacts that
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   413
            // are currently captured within the dragged element and
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   414
            // the current contact (if it isn't already in the list).
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   415
            List<InputDevice> devices = new List<InputDevice>();
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   416
            devices.Add(e.Contact);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   417
            foreach (Contact contact in draggedElement.ContactsCapturedWithin)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   418
            {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   419
                if (contact != e.Contact)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   420
                {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   421
                    devices.Add(contact);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   422
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   423
            }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   424
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   425
            // Get the drag source object
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   426
            ItemsControl dragSource = ItemsControl.ItemsControlFromItemContainer(draggedElement);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   427
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   428
            bool startDragOkay =
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   429
                SurfaceDragDrop.BeginDragDrop(
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   430
                  dragSource,                 // The SurfaceListBox object that the cursor is dragged out from.
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   431
                  draggedElement,             // The SurfaceListBoxItem object that is dragged from the drag source.
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   432
                  cursorVisual,               // The visual element of the cursor.
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   433
                  draggedElement.DataContext, // The data associated with the cursor.
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   434
                  devices,                    // The input devices that start dragging the cursor.
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   435
                  DragDropEffects.Move);      // The allowed drag-and-drop effects of the operation.
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   436
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   437
            // If the drag began successfully, set e.Handled to true. 
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   438
            // Otherwise SurfaceListBoxItem captures the contact 
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   439
            // and causes the drag operation to fail.
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   440
            e.Handled = startDragOkay;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   441
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   442
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   443
        private void onDragCanceled(Object sender, SurfaceDragDropEventArgs e)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   444
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   445
            // We check if the annotation is well one of the current annotations
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   446
            if (cut != null)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   447
            {
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   448
                // e.Cursor.Visual is the ContentControl, so its Content is the dragged TimelineAnnotationView
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   449
                canceledAnnotationVM = (AnnotationViewModel)((TimelineAnnotationView)((ContentControl)e.Cursor.Visual).Content).DataContext;
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   450
                confirmCancelPopup.Visibility = Visibility.Visible;
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   451
            }
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   452
        }
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   453
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   454
        private void confirmCancelPopup_ConfirmYesOrNo(object sender, ConfirmEventArgs e)
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   455
        {
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   456
            // We check if the annotation is well one of the current annotations
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   457
            if (cut != null && canceledAnnotationVM != null && e.Confirmed == true)
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   458
            {
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   459
                foreach (Annotation a in cut.AnnotList)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   460
                {
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   461
                    // Check begin TcBegin, duration and gesture type
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   462
                    if (a.TcBegin == canceledAnnotationVM.TcBegin && a.Dur == canceledAnnotationVM.Dur && a.GestureType == canceledAnnotationVM.GestureType)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   463
                    {
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   464
                        // We found the good annotation so we can remove it
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   465
                        cut.AnnotList.Remove(a);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   466
                        // We redisplay the timeline
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   467
                        //CuttingVM.setListFromAnnotations(cut.AnnotList, AnnotWidth, tv.ScaleX);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   468
                        tv.DataContext = null;
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   469
                        tv.DataContext = new CuttingViewModel(cut, AnnotWidth, tv.ScaleX);
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 186
diff changeset
   470
                        // We close the popup and return as soon as we removed the annotation to avoid an error on cut.AnnotList, which is just modified
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   471
                        confirmCancelPopup.Visibility = Visibility.Hidden;
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   472
                        canceledAnnotationVM = null;
195
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 194
diff changeset
   473
                        if (AnnotationRemoved != null)
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 194
diff changeset
   474
                            AnnotationRemoved(a, null);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   475
                        return;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   476
                    }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   477
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   478
            }
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   479
            confirmCancelPopup.Visibility = Visibility.Hidden;
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 136
diff changeset
   480
            canceledAnnotationVM = null;
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   481
        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 124
diff changeset
   482
216
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   483
        //
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   484
        // Is search mode, function of the search gesture, we have to be able to update frequently the current list of annotation
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   485
        //
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   486
        public void updateAnnotationList(List<Annotation> la)
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   487
        {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   488
            tv.DataContext = new CuttingViewModel(new Cutting("temp", "search", la), AnnotWidth, tv.ScaleX);
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   489
        }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   490
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   491
        //
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   492
        // Is search mode, we need the timeline to send the NewGestureEvent
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   493
        //
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   494
        public void sendNewGesture(String gestureName)
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   495
        {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   496
            NewGestureRecognized(this, new NewGestureRecognizedEventArg(gestureName));
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   497
        }
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 216
diff changeset
   498
    }
216
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   499
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   500
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   501
    /// <summary>
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   502
    /// AnnotationOrSearchEventArg
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   503
    /// </summary>
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   504
    public class NewGestureRecognizedEventArg : EventArgs
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   505
    {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   506
        public String GestureName
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   507
        {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   508
            get;
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   509
            set;
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   510
        }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   511
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   512
        public NewGestureRecognizedEventArg(String gestureName)
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   513
        {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   514
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   515
            GestureName = gestureName;
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   516
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   517
        }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 215
diff changeset
   518
    }
10
e8bfe1102e03 Modif sur ControlPlayer pour les videos.
sarias
parents:
diff changeset
   519
}