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