author | cavaliet |
Tue, 17 Nov 2009 13:20:22 +0100 | |
changeset 203 | 2948b34324bb |
parent 195 | 48b3139bb182 |
child 206 | 89813df17ec2 |
permissions | -rw-r--r-- |
35 | 1 |
using System; |
2 |
using System.IO; |
|
3 |
using System.Net; |
|
4 |
using System.Windows; |
|
5 |
using System.Windows.Controls; |
|
6 |
using System.Windows.Data; |
|
7 |
using System.Windows.Media; |
|
8 |
using System.Windows.Media.Animation; |
|
9 |
using System.Windows.Navigation; |
|
39 | 10 |
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
|
11 |
using FingersDance.Data; |
195
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
12 |
using FingersDance.Factory; |
203
2948b34324bb
first step of adding annotation from a recognised gesture.
cavaliet
parents:
195
diff
changeset
|
13 |
using GestureControl; |
35 | 14 |
|
15 |
namespace FingersDance.Control.SyncSource |
|
16 |
{ |
|
17 |
public partial class UserControlSyncSource |
|
18 |
{ |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
19 |
#region Variables |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
20 |
public event EventHandler OnSuccessAnnotation; |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
21 |
#endregion |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
22 |
|
35 | 23 |
public UserControlSyncSource() |
24 |
{ |
|
25 |
this.InitializeComponent(); |
|
26 |
||
27 |
// Insert code required on object creation below this point. |
|
28 |
} |
|
29 |
||
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
|
30 |
public void Load(string path, Color col, Cutting cut) |
119 | 31 |
{ |
32 |
this.UserControlPlayer.initPlayer(path); |
|
150
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
143
diff
changeset
|
33 |
//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
|
34 |
UCTimeLine.initTimer(col, cut); |
143 | 35 |
this.UserControlPlayer.playerPlay(); |
195
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
36 |
this.userControlTimeLine.OnSuccessAnnotation += new EventHandler(userControlTimeLine_OnSuccessAnnotation); |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
37 |
this.userControlTimeLine.AnnotationAdded += new EventHandler(userControlTimeLine_AnnotationAdded); |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
38 |
this.userControlTimeLine.AnnotationRemoved += new EventHandler(userControlTimeLine_AnnotationRemoved); |
203
2948b34324bb
first step of adding annotation from a recognised gesture.
cavaliet
parents:
195
diff
changeset
|
39 |
this.UserControlPlayer.PlayerStopOrPause += new EventHandler(UserControlPlayer_PlayerStopOrPause); |
2948b34324bb
first step of adding annotation from a recognised gesture.
cavaliet
parents:
195
diff
changeset
|
40 |
UserControlPlayer.NewGestureRegognized += new EventHandler(UCTimeLine.UserControlPlayer_NewGestureRegognized); |
119 | 41 |
} |
35 | 42 |
|
195
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
43 |
void userControlTimeLine_AnnotationRemoved(object sender, EventArgs e) |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
44 |
{ |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
45 |
try |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
46 |
{ |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
47 |
DataDictionary Data = (new DataFactory()).Data; |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
48 |
Data.RemoveAnnotation((Annotation)sender); |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
49 |
} |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
50 |
catch { } |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
51 |
} |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
52 |
|
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
53 |
// Ajout Annotation |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
54 |
void userControlTimeLine_AnnotationAdded(object sender, EventArgs e) |
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 |
try |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
57 |
{ |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
58 |
DataDictionary Data = (new DataFactory()).Data; |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
59 |
Data.AddAnnotation((Annotation)sender); |
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 |
catch { } |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
62 |
} |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
63 |
|
35 | 64 |
#region player |
65 |
private void UserControlPlayer_PlayerOpened(object sender, EventArgs e) |
|
66 |
{ |
|
67 |
//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
|
68 |
UCTimeLine.initslider(UserControlPlayer.TotalMilliseconds); |
35 | 69 |
//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
|
70 |
UCTimeLine.timerStart(); |
35 | 71 |
|
72 |
} |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
73 |
|
165 | 74 |
public void UserControlPlayer_PlayerStopOrPause(object sender, EventArgs e) |
168
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
75 |
{ |
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
76 |
try |
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
77 |
{ |
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
78 |
userControlTimeLine.thumbRotation((bool)sender); |
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
79 |
}catch(Exception ){} |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
80 |
} |
188
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
81 |
|
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
82 |
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
|
83 |
{ |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
84 |
try |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
85 |
{ |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
86 |
UserControlPlayer.setSound(val); |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
87 |
} |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
88 |
catch (Exception) { } |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
89 |
} |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
90 |
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
|
91 |
{ |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
92 |
try |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
93 |
{ |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
94 |
UserControlPlayer.setMute(b); |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
95 |
} |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
96 |
catch (Exception) { } |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
97 |
} |
e642ad0c366b
Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents:
186
diff
changeset
|
98 |
|
35 | 99 |
#endregion |
100 |
||
101 |
#region TimeLine |
|
102 |
||
103 |
||
104 |
private void UserControlTimeLine_DragStarted(object sender, EventArgs e) |
|
105 |
{ |
|
106 |
UserControlPlayer.playerPause(); |
|
107 |
} |
|
108 |
||
109 |
||
110 |
private void UserControlTimeLine_DragCompleted(object sender, EventArgs e) |
|
111 |
{ |
|
112 |
} |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
113 |
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
|
114 |
{ |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
115 |
OnSuccessAnnotation(this, new EventArgs()); |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
116 |
} |
168
d70ee2002f75
Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents:
165
diff
changeset
|
117 |
|
35 | 118 |
#endregion |
119 |
||
120 |
||
121 |
#region SynSource pour chaque X milliseconds |
|
122 |
private void UserControlTimeLine_TimerTick(object sender, EventArgs e) |
|
123 |
{ |
|
75
99d003723474
data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents:
39
diff
changeset
|
124 |
if (!UCTimeLine.IsDragging) |
35 | 125 |
{ |
75
99d003723474
data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents:
39
diff
changeset
|
126 |
UCTimeLine.Slider.Value = UserControlPlayer.Player.Position.TotalMilliseconds; |
35 | 127 |
} |
195
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
128 |
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
|
129 |
if (UCTimeLine.FinishedDragging) |
35 | 130 |
{ |
131 |
TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue); |
|
132 |
||
133 |
UserControlPlayer.Player.Position = ts; |
|
134 |
UserControlPlayer.playerPlay(); |
|
195
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
135 |
UserControlPlayer.Time = (float)SliderValue / 1000; |
35 | 136 |
|
75
99d003723474
data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents:
39
diff
changeset
|
137 |
UCTimeLine.IsDragging = false; |
99d003723474
data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents:
39
diff
changeset
|
138 |
UCTimeLine.FinishedDragging = false; |
35 | 139 |
} |
195
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
140 |
DataDictionary Data = (new DataFactory()).Data; |
48b3139bb182
Dictionnaire de données
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
193
diff
changeset
|
141 |
UserControlPlayer.ApplyColor(Data.GetColors((int)((float)SliderValue / 1000))); |
35 | 142 |
} |
143 |
#endregion |
|
75
99d003723474
data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents:
39
diff
changeset
|
144 |
|
99d003723474
data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents:
39
diff
changeset
|
145 |
public UserControlTimeLine userControlTimeLine |
99d003723474
data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents:
39
diff
changeset
|
146 |
{ |
99d003723474
data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents:
39
diff
changeset
|
147 |
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
|
148 |
} |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
149 |
|
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
150 |
public void PlayerPause() |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
151 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
152 |
UserControlPlayer.playerPause(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
153 |
} |
35 | 154 |
} |
155 |
} |