src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs
author ARIAS Santiago
Tue, 24 Nov 2009 07:50:17 +0100
changeset 224 874de6d84a2e
parent 216 45d2dff788f2
child 225 b60e13ed75c8
permissions -rw-r--r--
Panels visibility Pivot Position OnContactLeave UserPanel Close "UserTest" removed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     1
using System;
216
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
     2
using System.Collections.Generic;
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     3
using System.IO;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     4
using System.Net;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     5
using System.Windows;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     6
using System.Windows.Controls;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     7
using System.Windows.Data;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     8
using System.Windows.Media;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     9
using System.Windows.Media.Animation;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    10
using System.Windows.Navigation;
216
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    11
39
0efa1d506f28 Correct compilation + lib
ymh
parents: 35
diff changeset
    12
using FingersDance.Control.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: 188
diff changeset
    13
using FingersDance.Data;
216
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    14
using FingersDance.ViewModels;
195
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    15
using FingersDance.Factory;
203
2948b34324bb first step of adding annotation from a recognised gesture.
cavaliet
parents: 195
diff changeset
    16
using GestureControl;
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    17
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    18
namespace FingersDance.Control.SyncSource
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    19
{
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    20
	public partial class UserControlSyncSource
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    21
	{
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    22
        #region Variables   
216
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    23
        public event EventHandler OnSuccessAnnotation;
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    24
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    25
        private String AnnotationOrSearchMode;
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    26
        private Project searchedProject;
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    27
        #endregion
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    28
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    29
		public UserControlSyncSource()
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    30
		{
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    31
			this.InitializeComponent();
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    32
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    33
			// Insert code required on object creation below this point.
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    34
		}
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    35
216
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    36
        public void Load(string path, Color col, Cutting cut, String AnnotOrSearchMode, Project searchedProj)
119
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 75
diff changeset
    37
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 75
diff changeset
    38
            this.UserControlPlayer.initPlayer(path);
216
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    39
            AnnotationOrSearchMode = AnnotOrSearchMode;
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    40
            searchedProject = searchedProj;
150
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 143
diff changeset
    41
            //Initialisation du Timer
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: 188
diff changeset
    42
            UCTimeLine.initTimer(col, cut);
216
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    43
            UserControlPlayer.playerPlay();
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    44
            userControlTimeLine.OnSuccessAnnotation += new EventHandler(userControlTimeLine_OnSuccessAnnotation);
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    45
            userControlTimeLine.AnnotationAdded += new EventHandler(userControlTimeLine_AnnotationAdded);
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    46
            userControlTimeLine.AnnotationRemoved += new EventHandler(userControlTimeLine_AnnotationRemoved);
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    47
            UserControlPlayer.PlayerStopOrPause += new EventHandler(UserControlPlayer_PlayerStopOrPause);
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    48
            UserControlPlayer.NewGestureRegognized += new EventHandler(UserControlPlayer_NewGestureRegognized);
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
    49
            UCTimeLine.NewGestureRecognized += new EventHandler<NewGestureRecognizedEventArg>(UCTimeLine_NewGestureRecognized);
119
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 75
diff changeset
    50
        }
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    51
195
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    52
        void userControlTimeLine_AnnotationRemoved(object sender, EventArgs e)
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    53
        {
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    54
            try
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    55
            {
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    56
                DataDictionary Data = (new DataFactory()).Data;
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    57
                Data.RemoveAnnotation((Annotation)sender);
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    58
            }
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    59
            catch { }
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    60
        }
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    61
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    62
        //  Ajout Annotation
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    63
        void userControlTimeLine_AnnotationAdded(object sender, EventArgs e)
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    64
        {
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    65
            try
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    66
            {
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    67
                DataDictionary Data = (new DataFactory()).Data;
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    68
                Data.AddAnnotation((Annotation)sender);
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    69
            }
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    70
            catch { }
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    71
        }
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
    72
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    73
        #region player
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    74
        private void UserControlPlayer_PlayerOpened(object sender, EventArgs e)
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    75
        {
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    76
            //Initialisation du slider
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
    77
            UCTimeLine.initslider(UserControlPlayer.TotalMilliseconds);
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    78
            //Demarrage du Timer
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
    79
            UCTimeLine.timerStart();
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    80
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    81
        }
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    82
165
e78e40b9d761 Pivot Improved and methods for timeline
riley
parents: 162
diff changeset
    83
        public void UserControlPlayer_PlayerStopOrPause(object sender, EventArgs e)
168
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 165
diff changeset
    84
        {
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 165
diff changeset
    85
            try
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 165
diff changeset
    86
            {
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 165
diff changeset
    87
                userControlTimeLine.thumbRotation((bool)sender);
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 165
diff changeset
    88
            }catch(Exception ){}
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    89
        }
188
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
    90
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
    91
        public void setUserPlayerVolume(double val)
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
    92
        {
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
    93
            try
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
    94
            {
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
    95
                UserControlPlayer.setSound(val);
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
    96
            }
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
    97
            catch (Exception) { }
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
    98
        }
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
    99
        public void setUserPlayerMute(bool b)
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   100
        {
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   101
            try
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   102
            {
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   103
                UserControlPlayer.setMute(b);
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   104
            }
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   105
            catch (Exception) { }
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   106
        }
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   107
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   108
        #endregion
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   109
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   110
        #region TimeLine
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   111
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   112
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   113
        private void UserControlTimeLine_DragStarted(object sender, EventArgs e)
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   114
        {
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   115
            UserControlPlayer.playerPause();
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   116
        }
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   117
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   118
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   119
        private void UserControlTimeLine_DragCompleted(object sender, EventArgs e)
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   120
        {
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   121
        }
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   122
        private void userControlTimeLine_OnSuccessAnnotation(object sender, EventArgs e)
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   123
        {
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   124
            OnSuccessAnnotation(this, new EventArgs());
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   125
        }
168
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 165
diff changeset
   126
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   127
        #endregion
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   128
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   129
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   130
        #region SynSource pour chaque X milliseconds
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   131
        private void UserControlTimeLine_TimerTick(object sender, EventArgs e)
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   132
        {
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
   133
            if (!UCTimeLine.IsDragging)
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   134
            {
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 216
diff changeset
   135
                
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 216
diff changeset
   136
                    UCTimeLine.Slider.Value = UserControlPlayer.Player.Position.TotalMilliseconds;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 216
diff changeset
   137
            
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   138
            }
195
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
   139
            int SliderValue = (int)UCTimeLine.Slider.Value;
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
   140
            if (UCTimeLine.FinishedDragging)
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   141
            {
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   142
                TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue);
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   143
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   144
                UserControlPlayer.Player.Position = ts;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   145
                UserControlPlayer.playerPlay();
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   146
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
   147
                UCTimeLine.IsDragging = false;
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
   148
                UCTimeLine.FinishedDragging = false;
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   149
            }
205
468f3757f1f8 Correction probleme tc annotation
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 195
diff changeset
   150
            UserControlPlayer.Time = (float)SliderValue / 1000;
195
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
   151
            DataDictionary Data = (new DataFactory()).Data;
48b3139bb182 Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 193
diff changeset
   152
            UserControlPlayer.ApplyColor(Data.GetColors((int)((float)SliderValue / 1000)));
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   153
        }
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   154
        #endregion
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
   155
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
   156
        public UserControlTimeLine userControlTimeLine
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
   157
        {
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
   158
            get { return this.UCTimeLine; }
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
   159
        }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   160
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   161
        public void PlayerPause()
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   162
        {
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   163
            UserControlPlayer.playerPause();
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   164
        }
216
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   165
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 216
diff changeset
   166
        public void SyncSourceClose()
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 216
diff changeset
   167
        {
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 216
diff changeset
   168
            //TimeLine and Player To Null
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 216
diff changeset
   169
            UCTimeLine.TimerTick -= UserControlTimeLine_TimerTick;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 216
diff changeset
   170
            UCTimeLine = null;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 216
diff changeset
   171
            UserControlPlayer.playerStop();
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 216
diff changeset
   172
            UserControlPlayer = null;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 216
diff changeset
   173
        }
216
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   174
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   175
        public void UserControlPlayer_NewGestureRegognized(object sender, EventArgs e)
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   176
        {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   177
            try
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   178
            {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   179
                GestureEventArg grea = (GestureEventArg)e;
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   180
                //Console.WriteLine("Timeline NewGestureRegognized " + grea.Gesture.Name + ", " + grea.Gesture.Start + ", " + grea.Gesture.End);
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   181
                if (AnnotationOrSearchMode == "Annotation")
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   182
                {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   183
                    // If the stroke has been drawed very fast, end and start can be the same, so we add a little length.
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   184
                    float dur = (float)(grea.End - grea.Start);
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   185
                    if (dur == 0) dur = (float)0.5;
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   186
                    foreach (Gesture elt in grea.Gestures)
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   187
                        UCTimeLine.addAnnotation((float)grea.Start, dur, elt.Name);
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   188
                }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   189
                else
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   190
                {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   191
                    // We are in search mode. So we have to get all the searchedProject's annotation which have the wanted gesture
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   192
                    List<Annotation> searchedAnnot = new List<Annotation>();
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   193
                    foreach(Cutting cut in searchedProject.Cuttings)
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   194
                    {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   195
                        foreach (Annotation annot in cut.AnnotList)
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   196
                        {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   197
                            foreach(Gesture gest in grea.Gestures)
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   198
                                if (annot.GestureType == gest.Name)
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   199
                                {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   200
                                    // One of the gesture is enough for the annotation to be added
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   201
                                    searchedAnnot.Add(annot);
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   202
                                    break;
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   203
                                }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   204
                        }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   205
                    }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   206
                    // The list was built. If the number of found annotations is >0, we send the list to the timeline
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   207
                    UCTimeLine.updateAnnotationList(searchedAnnot);
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   208
                }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   209
            }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   210
            catch { }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   211
        }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   212
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   213
        public void searchAnnotations(String gestureName)
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   214
        {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   215
            // We are in search mode. So we have to get all the searchedProject's annotation which have the wanted gesture
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   216
            List<Annotation> searchedAnnot = new List<Annotation>();
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   217
            foreach (Cutting cut in searchedProject.Cuttings)
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   218
            {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   219
                foreach (Annotation annot in cut.AnnotList)
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   220
                {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   221
                    if (annot.GestureType == gestureName)
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   222
                    {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   223
                        // One of the gesture is enough for the annotation to be added
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   224
                        searchedAnnot.Add(annot);
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   225
                    }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   226
                }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   227
            }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   228
            // The list was built. If the number of found annotations is >0, we send the list to the timeline
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   229
            UCTimeLine.updateAnnotationList(searchedAnnot);
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   230
        }
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   231
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   232
        void UCTimeLine_NewGestureRecognized(object sender, NewGestureRecognizedEventArg e)
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   233
        {
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   234
            searchAnnotations(e.GestureName);
45d2dff788f2 almost last step of search : menu is active and we listen to the recognised event from the player.
cavaliet
parents: 206
diff changeset
   235
        }
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   236
    }
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   237
}