author | sarias |
Fri, 16 Oct 2009 21:06:25 +0200 | |
changeset 162 | 0b9f989bcb37 |
parent 160 | e940ca798fe3 |
child 168 | d70ee2002f75 |
permissions | -rw-r--r-- |
45 | 1 |
using System; |
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Windows; |
|
6 |
using System.Windows.Controls; |
|
7 |
using System.Windows.Data; |
|
8 |
using System.Windows.Documents; |
|
9 |
using System.Windows.Input; |
|
10 |
using System.Windows.Media; |
|
11 |
using System.Windows.Media.Imaging; |
|
12 |
using System.Windows.Shapes; |
|
13 |
using System.Windows.Threading; |
|
14 |
using Microsoft.Surface; |
|
15 |
using Microsoft.Surface.Presentation; |
|
16 |
using Microsoft.Surface.Presentation.Controls; |
|
17 |
||
60 | 18 |
using FingersDance.Control.UserPanel; |
82 | 19 |
using FingersDance.Control.Screen; |
143 | 20 |
using FingersDance.Control.Close; |
21 |
using FingersDance.ViewModels; |
|
22 |
using FingersDance.Data; |
|
156
e16c8c913c65
Color Factory et application des couleurs au pivot
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
152
diff
changeset
|
23 |
using FingersDance.Factory; |
60 | 24 |
|
45 | 25 |
namespace FingersDance |
26 |
{ |
|
27 |
/// <summary> |
|
28 |
/// Interaction logic for SurfaceWindow1.xaml |
|
29 |
/// </summary> |
|
30 |
public partial class SurfaceWindow1 : SurfaceWindow |
|
31 |
{ |
|
32 |
/// <summary> |
|
33 |
/// Default constructor. |
|
34 |
/// </summary> |
|
54
c724ac229181
Singleton de la factory
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
45
diff
changeset
|
35 |
/// |
60 | 36 |
#region Variables |
143 | 37 |
|
112 | 38 |
private UserControlUserPanel Panel1 = null; |
39 |
private UserControlUserPanel Panel2 = null; |
|
40 |
private UserControlUserPanel Panel3 = null; |
|
41 |
private UserControlUserPanel Panel4 = null; |
|
156
e16c8c913c65
Color Factory et application des couleurs au pivot
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
152
diff
changeset
|
42 |
ActionGenerator _Factory = (new ActionFactory()).GetGenerator(); |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
43 |
private MainViewModel _mainviewmodel = new MainViewModel(); |
60 | 44 |
#endregion |
54
c724ac229181
Singleton de la factory
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
45
diff
changeset
|
45 |
|
c724ac229181
Singleton de la factory
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
45
diff
changeset
|
46 |
|
143 | 47 |
#region Constructor |
45 | 48 |
public SurfaceWindow1() |
49 |
{ |
|
50 |
InitializeComponent(); |
|
60 | 51 |
//Permet d'initialiser l'inertie du Pivot une fois relach�. |
52 |
InitPivotInertia(); |
|
58
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
53 |
//Permet d'initialiser les quand Grid � la position initiale du pivot |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
54 |
InitGridPositions(); |
45 | 55 |
// Add handlers for Application activation events |
56 |
AddActivationHandlers(); |
|
57 |
} |
|
143 | 58 |
#endregion |
59 |
||
60 |
#region Initialization |
|
45 | 61 |
|
60 | 62 |
private void InitPivotInertia() |
63 |
{ |
|
64 |
try |
|
65 |
{ |
|
77 | 66 |
ScatterViewItem item = (ScatterViewItem)scaterview.Items.GetItemAt(0); |
60 | 67 |
item.DecelerationRate = double.NaN; |
68 |
} |
|
69 |
catch (Exception ex) { } |
|
70 |
} |
|
71 |
||
58
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
72 |
private void InitGridPositions() |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
73 |
{ |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
74 |
//Initialise les 4 Grids � la positions initiale du Pivot. |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
75 |
try |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
76 |
{ |
77 | 77 |
ScatterViewItem item = (ScatterViewItem)scaterview.Items.GetItemAt(0); |
58
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
78 |
Grid1.Width =item.Center.X; |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
79 |
Grid1.Height = item.Center.Y; |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
80 |
|
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
81 |
Grid2.Width = item.Center.X; |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
82 |
Grid2.Height = 768 - item.Center.Y; |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
83 |
|
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
84 |
Grid3.Width = 1024 - item.Center.X; |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
85 |
Grid3.Height = 768 - item.Center.Y; |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
86 |
|
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
87 |
Grid4.Width = 1024 - item.Center.X; |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
88 |
Grid4.Height = item.Center.Y; |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
89 |
} |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
90 |
catch (Exception ex) { } |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
91 |
} |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
92 |
|
143 | 93 |
#endregion |
45 | 94 |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
95 |
#region Application Default Functions |
45 | 96 |
/// <summary> |
97 |
/// Occurs when the window is about to close. |
|
98 |
/// </summary> |
|
99 |
/// <param name="e"></param> |
|
100 |
protected override void OnClosed(EventArgs e) |
|
101 |
{ |
|
102 |
base.OnClosed(e); |
|
103 |
||
104 |
// Remove handlers for Application activation events |
|
105 |
RemoveActivationHandlers(); |
|
106 |
} |
|
107 |
||
108 |
/// <summary> |
|
109 |
/// Adds handlers for Application activation events. |
|
110 |
/// </summary> |
|
111 |
private void AddActivationHandlers() |
|
112 |
{ |
|
113 |
// Subscribe to surface application activation events |
|
114 |
ApplicationLauncher.ApplicationActivated += OnApplicationActivated; |
|
115 |
ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed; |
|
116 |
ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated; |
|
117 |
} |
|
118 |
||
119 |
/// <summary> |
|
120 |
/// Removes handlers for Application activation events. |
|
121 |
/// </summary> |
|
122 |
private void RemoveActivationHandlers() |
|
123 |
{ |
|
124 |
// Unsubscribe from surface application activation events |
|
125 |
ApplicationLauncher.ApplicationActivated -= OnApplicationActivated; |
|
126 |
ApplicationLauncher.ApplicationPreviewed -= OnApplicationPreviewed; |
|
127 |
ApplicationLauncher.ApplicationDeactivated -= OnApplicationDeactivated; |
|
128 |
} |
|
129 |
||
130 |
/// <summary> |
|
131 |
/// This is called when application has been activated. |
|
132 |
/// </summary> |
|
133 |
/// <param name="sender"></param> |
|
134 |
/// <param name="e"></param> |
|
135 |
private void OnApplicationActivated(object sender, EventArgs e) |
|
136 |
{ |
|
137 |
//TODO: enable audio, animations here |
|
143 | 138 |
|
45 | 139 |
} |
140 |
||
141 |
/// <summary> |
|
142 |
/// This is called when application is in preview mode. |
|
143 |
/// </summary> |
|
144 |
/// <param name="sender"></param> |
|
145 |
/// <param name="e"></param> |
|
146 |
private void OnApplicationPreviewed(object sender, EventArgs e) |
|
147 |
{ |
|
148 |
//TODO: Disable audio here if it is enabled |
|
149 |
||
150 |
//TODO: optionally enable animations here |
|
151 |
} |
|
152 |
||
153 |
/// <summary> |
|
154 |
/// This is called when application has been deactivated. |
|
155 |
/// </summary> |
|
156 |
/// <param name="sender"></param> |
|
157 |
/// <param name="e"></param> |
|
158 |
private void OnApplicationDeactivated(object sender, EventArgs e) |
|
159 |
{ |
|
160 |
//TODO: disable audio, animations here |
|
161 |
} |
|
162 |
||
143 | 163 |
/// <summary> |
164 |
/// This is called when application has been loaded, we change the orientation |
|
165 |
/// of the application |
|
166 |
/// </summary> |
|
167 |
/// <param name="sender"></param> |
|
168 |
/// <param name="e"></param> |
|
169 |
private void mainSurfaceWindow_Loaded(object sender, RoutedEventArgs e) |
|
170 |
{ |
|
171 |
||
172 |
if (ApplicationLauncher.InitialOrientation == UserOrientation.Top) |
|
173 |
{ |
|
174 |
// Rotate the main canvas by 180 degrees. |
|
175 |
this.MainGrid.LayoutTransform = new RotateTransform(180.0); |
|
176 |
} |
|
177 |
else |
|
178 |
{ |
|
179 |
// Remove the rotate transform on the main canvas. |
|
180 |
this.MainGrid.LayoutTransform = null; |
|
181 |
} |
|
182 |
// Dismiss the loading screen. |
|
183 |
ApplicationLauncher.SignalApplicationLoadComplete(); |
|
184 |
} |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
185 |
#endregion |
143 | 186 |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
187 |
|
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
188 |
|
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
189 |
|
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
190 |
#region Pivot Actions |
77 | 191 |
private void scaterview_ContactChanged(object sender, ContactEventArgs e) |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
192 |
{ } |
77 | 193 |
private void ScatterViewItemPivot_ContactChanged(object sender, ContactEventArgs e) |
45 | 194 |
{ |
58
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
195 |
//Permet la MAJ des 4 Grids � la position du pivot |
45 | 196 |
try |
197 |
{ |
|
198 |
Grid1.Width = e.GetPosition(mainSurfaceWindow).X; |
|
199 |
Grid1.Height = e.GetPosition(mainSurfaceWindow).Y; |
|
200 |
||
60 | 201 |
Grid3.Width = e.GetPosition(mainSurfaceWindow).X; |
45 | 202 |
Grid3.Height = 768 - e.GetPosition(mainSurfaceWindow).Y; |
203 |
||
204 |
Grid4.Width = 1024 - e.GetPosition(mainSurfaceWindow).X; |
|
60 | 205 |
Grid4.Height = 768 - e.GetPosition(mainSurfaceWindow).Y; |
206 |
||
207 |
Grid2.Width = 1024 - e.GetPosition(mainSurfaceWindow).X; |
|
208 |
Grid2.Height = e.GetPosition(mainSurfaceWindow).Y; |
|
89 | 209 |
|
91 | 210 |
//GRISAGE |
211 |
//Grid1 |
|
212 |
if (Grid1.Width < (1024 / 4) || Grid2.Height < (768 / 4)) |
|
89 | 213 |
{ |
91 | 214 |
try |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
215 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
216 |
if (Panel1 != null) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
217 |
Panel1.PlayerPause(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
218 |
Grid1.Children[1].Visibility = Visibility.Hidden; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
219 |
} |
91 | 220 |
catch (Exception) { } |
89 | 221 |
} |
91 | 222 |
else |
223 |
{ |
|
224 |
try |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
225 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
226 |
Grid1.Children[1].Visibility = Visibility.Visible; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
227 |
} |
91 | 228 |
catch (Exception) { } |
229 |
} |
|
230 |
//Grid2 |
|
231 |
if (Grid2.Width < (1024 / 4) || Grid2.Height < (768 / 4)) |
|
89 | 232 |
{ |
91 | 233 |
try |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
234 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
235 |
if (Panel2 != null) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
236 |
Panel2.PlayerPause(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
237 |
Grid2.Children[1].Visibility = Visibility.Hidden; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
238 |
} |
91 | 239 |
catch (Exception) { } |
240 |
} |
|
241 |
else |
|
242 |
{ |
|
243 |
try |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
244 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
245 |
Grid2.Children[1].Visibility = Visibility.Visible; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
246 |
} |
91 | 247 |
catch (Exception) { } |
89 | 248 |
} |
91 | 249 |
//Grid3 |
250 |
if (Grid3.Width < (1024 / 4) || Grid3.Height < (768 / 4)) |
|
89 | 251 |
{ |
91 | 252 |
try |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
253 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
254 |
if (Panel3 != null) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
255 |
Panel3.PlayerPause(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
256 |
Grid3.Children[1].Visibility = Visibility.Hidden; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
257 |
} |
91 | 258 |
catch (Exception) { } |
259 |
} |
|
260 |
else |
|
261 |
{ |
|
262 |
try |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
263 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
264 |
Grid3.Children[1].Visibility = Visibility.Visible; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
265 |
} |
91 | 266 |
catch (Exception) { } |
89 | 267 |
} |
91 | 268 |
//Grid4 |
269 |
if (Grid4.Width < (1024 / 4) || Grid4.Height < (768 / 4)) |
|
89 | 270 |
{ |
91 | 271 |
try |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
272 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
273 |
if (Panel4 != null) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
274 |
Panel4.PlayerPause(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
275 |
Grid4.Children[1].Visibility = Visibility.Hidden; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
276 |
} |
91 | 277 |
catch (Exception) { } |
89 | 278 |
} |
91 | 279 |
else |
280 |
{ |
|
281 |
try |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
282 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
283 |
Grid4.Children[1].Visibility = Visibility.Visible; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
284 |
} |
91 | 285 |
catch (Exception) { } |
286 |
} |
|
45 | 287 |
} |
91 | 288 |
catch (Exception) { } |
45 | 289 |
} |
60 | 290 |
|
112 | 291 |
private void UserControlPivot_EH_SurfaceButtonPlayer_ContactDown(object sender, EventArgs e) |
60 | 292 |
{ |
143 | 293 |
// Si aucune video n'a �t� s�lectionn�e et qu'une grid contient un �l�ment (listvideo), on ne fait rien |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
294 |
if (_mainviewmodel.Session.Name.Equals("") && (Grid1.Children.Count == 2 || Grid2.Children.Count == 2 || Grid3.Children.Count == 2 || Grid4.Children.Count == 2)) |
143 | 295 |
return; |
296 |
||
297 |
// Traitement du contact down sur le pivot (Cr�ation d'un screen ou suppression d'un panel |
|
112 | 298 |
switch ((int)sender) |
60 | 299 |
{ |
112 | 300 |
case 1: |
143 | 301 |
if (Panel1 == null && Grid1.Children.Count == 1) |
112 | 302 |
{ |
303 |
//1-Creation du control Screen |
|
143 | 304 |
UserControlScreen Screen = new UserControlScreen(1, _mainviewmodel); |
112 | 305 |
Screen.Name = "Screen1"; |
306 |
Screen.contexteGrid = Grid1.Name.ToString(); |
|
307 |
//2-Rajout du screen dans la grid correspondante |
|
308 |
Grid1.Children.Add(Screen); |
|
309 |
||
310 |
Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
|
311 |
} |
|
143 | 312 |
else //Affichage du message de confirmation |
313 |
{ |
|
314 |
if (Panel1 != null && Grid1.Children.Count == 2) |
|
315 |
{ |
|
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:
139
diff
changeset
|
316 |
UserControlClose UCclose = new UserControlClose(1, "�tes-vous s�r de vouloir quitter ?"); |
143 | 317 |
UCclose.Name = "CloseAlert1"; |
318 |
Grid1.Children.Add(UCclose); |
|
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:
139
diff
changeset
|
319 |
UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown); |
143 | 320 |
} |
321 |
} |
|
112 | 322 |
break; |
323 |
case 2: |
|
143 | 324 |
if (Panel2 == null && Grid2.Children.Count == 1) |
112 | 325 |
{ |
326 |
//1-Creation du control Screen |
|
143 | 327 |
UserControlScreen Screen = new UserControlScreen(2, _mainviewmodel); |
112 | 328 |
Screen.Name = "Screen2"; |
329 |
Screen.contexteGrid = Grid2.Name.ToString(); |
|
330 |
//2-Rajout du screen dans la grid correspondante |
|
331 |
Grid2.Children.Add(Screen); |
|
72
f1ca0958c992
Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents:
60
diff
changeset
|
332 |
|
112 | 333 |
Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
334 |
} |
|
143 | 335 |
else //Affichage du message de confirmation |
336 |
{ |
|
337 |
if (Panel2 != null && Grid2.Children.Count == 2) |
|
338 |
{ |
|
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:
139
diff
changeset
|
339 |
UserControlClose UCclose = new UserControlClose(2, "�tes-vous s�r de vouloir quitter ?"); |
143 | 340 |
UCclose.Name = "CloseAlert2"; |
341 |
Grid2.Children.Add(UCclose); |
|
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:
139
diff
changeset
|
342 |
UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown); |
143 | 343 |
} |
344 |
} |
|
112 | 345 |
break; |
346 |
case 3: |
|
143 | 347 |
if (Panel3 == null && Grid3.Children.Count == 1) |
112 | 348 |
{ |
349 |
//1-Creation du control Screen |
|
143 | 350 |
UserControlScreen Screen = new UserControlScreen(3, _mainviewmodel); |
112 | 351 |
Screen.Name = "Screen3"; |
352 |
Screen.contexteGrid = Grid3.Name.ToString(); |
|
353 |
//2-Rajout du screen dans la grid correspondante |
|
354 |
Grid3.Children.Add(Screen); |
|
72
f1ca0958c992
Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents:
60
diff
changeset
|
355 |
|
112 | 356 |
Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
357 |
} |
|
143 | 358 |
else //Affichage du message de confirmation |
359 |
{ |
|
360 |
if (Panel3 != null && Grid3.Children.Count == 2) |
|
361 |
{ |
|
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:
139
diff
changeset
|
362 |
UserControlClose UCclose = new UserControlClose(3, "�tes-vous s�r de vouloir quitter ?"); |
143 | 363 |
UCclose.Name = "CloseAlert3"; |
364 |
Grid3.Children.Add(UCclose); |
|
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:
139
diff
changeset
|
365 |
UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown); |
143 | 366 |
} |
367 |
} |
|
112 | 368 |
break; |
369 |
case 4: |
|
143 | 370 |
if (Panel4 == null && Grid4.Children.Count == 1) |
112 | 371 |
{ |
372 |
//1-Creation du control Screen |
|
143 | 373 |
UserControlScreen Screen = new UserControlScreen(4, _mainviewmodel); |
112 | 374 |
Screen.Name = "Screen4"; |
375 |
Screen.contexteGrid = Grid4.Name.ToString(); |
|
376 |
//2-Rajout du screen dans la grid correspondante |
|
377 |
Grid4.Children.Add(Screen); |
|
378 |
||
379 |
Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
|
380 |
} |
|
143 | 381 |
else //Affichage du message de confirmation |
382 |
{ |
|
383 |
if (Panel4 != null && Grid4.Children.Count == 2) |
|
384 |
{ |
|
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:
139
diff
changeset
|
385 |
UserControlClose UCclose = new UserControlClose(4, "�tes-vous s�r de vouloir quitter ?"); |
143 | 386 |
UCclose.Name = "CloseAlert4"; |
387 |
Grid4.Children.Add(UCclose); |
|
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:
139
diff
changeset
|
388 |
UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown); |
143 | 389 |
} |
390 |
} |
|
112 | 391 |
break; |
392 |
} |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
393 |
|
73 | 394 |
} |
72
f1ca0958c992
Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents:
60
diff
changeset
|
395 |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
396 |
#endregion |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
397 |
|
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
398 |
|
73 | 399 |
//Button Submit du control SessionInput |
400 |
private void SessionInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e) |
|
401 |
{ |
|
402 |
try |
|
403 |
{ |
|
112 | 404 |
//1-Suppression du UC Screen |
104 | 405 |
Grid root = (Grid)(((UserControlScreen)sender).Parent); |
406 |
root.Children.Remove(((UserControlScreen)sender)); |
|
143 | 407 |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
408 |
if (((UserControlScreen)sender).Project != null) |
112 | 409 |
{ |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
410 |
//2-Creation du User Panel |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
411 |
Project newProject = ((UserControlScreen)sender).Project.Project; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
412 |
|
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
413 |
if ((Panel1 != null && Panel1.Project.Equals(newProject)) || (Panel2 != null && Panel2.Project.Equals(newProject)) || (Panel3 != null && Panel3.Project.Equals(newProject)) || (Panel4 != null && Panel4.Project.Equals(newProject))) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
414 |
return; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
415 |
|
156
e16c8c913c65
Color Factory et application des couleurs au pivot
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
152
diff
changeset
|
416 |
Random c = new Random(); |
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:
156
diff
changeset
|
417 |
uint color = (uint)c.Next(12) + 1; // for the number to be >0 |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
418 |
switch (((UserControlScreen)sender).id) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
419 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
420 |
case 1: |
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:
156
diff
changeset
|
421 |
UserControlPivot.ApplyColor(1, color); |
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:
156
diff
changeset
|
422 |
Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
423 |
Panel1.Name = "UserPanel1"; |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
424 |
Panel1.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
425 |
Panel1.idcolor = color; |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
426 |
//3-Rajout sur la Grid Root |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
427 |
root.Children.Add(Panel1); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
428 |
break; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
429 |
case 2: |
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:
156
diff
changeset
|
430 |
UserControlPivot.ApplyColor(2, color); |
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:
156
diff
changeset
|
431 |
Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
432 |
Panel2.Name = "UserPanel2"; |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
433 |
Panel2.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
434 |
Panel2.idcolor = color; |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
435 |
//3-Rajout sur la Grid Root |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
436 |
root.Children.Add(Panel2); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
437 |
break; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
438 |
case 3: |
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:
156
diff
changeset
|
439 |
UserControlPivot.ApplyColor(3, color); |
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:
156
diff
changeset
|
440 |
Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
441 |
Panel3.Name = "UserPanel3"; |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
442 |
Panel3.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
443 |
Panel3.idcolor = color; |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
444 |
//3-Rajout sur la Grid Root |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
445 |
root.Children.Add(Panel3); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
446 |
break; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
447 |
case 4: |
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:
156
diff
changeset
|
448 |
UserControlPivot.ApplyColor(4, color); |
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:
156
diff
changeset
|
449 |
Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath); |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
450 |
Panel4.Name = "UserPanel4"; |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
451 |
Panel4.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation); |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
452 |
Panel4.idcolor = color; |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
453 |
//3-Rajout sur la Grid Root |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
454 |
root.Children.Add(Panel4); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
455 |
break; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
456 |
} |
112 | 457 |
} |
73 | 458 |
} |
459 |
catch (Exception ex) { } |
|
72
f1ca0958c992
Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents:
60
diff
changeset
|
460 |
} |
73 | 461 |
|
143 | 462 |
//Actions du boutton Alert selon l'action close OK ou NON |
141
923687896770
UserControlClose more readable and MainSurfaceWindow now uses the ConfirmYesOrNo event.
cavaliet
parents:
140
diff
changeset
|
463 |
private void CloseAlert_EH_SurfaceButton_ContactDown(object sender, ConfirmEventArgs e) |
143 | 464 |
{ |
465 |
Grid root = (Grid)(((UserControlClose)sender).Parent); |
|
141
923687896770
UserControlClose more readable and MainSurfaceWindow now uses the ConfirmYesOrNo event.
cavaliet
parents:
140
diff
changeset
|
466 |
if(e.Confirmed==true) |
143 | 467 |
{ |
141
923687896770
UserControlClose more readable and MainSurfaceWindow now uses the ConfirmYesOrNo event.
cavaliet
parents:
140
diff
changeset
|
468 |
switch(e.PanelNumber) |
143 | 469 |
{ |
470 |
case 1: |
|
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:
156
diff
changeset
|
471 |
UserControlPivot.ApplyColor(1, 0); |
143 | 472 |
root.Children.Remove(Panel1); |
473 |
Panel1 = null; |
|
474 |
break; |
|
475 |
case 2: |
|
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:
156
diff
changeset
|
476 |
UserControlPivot.ApplyColor(2, 0); |
143 | 477 |
root.Children.Remove(Panel2); |
478 |
Panel2 = null; |
|
479 |
break; |
|
480 |
case 3: |
|
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:
156
diff
changeset
|
481 |
UserControlPivot.ApplyColor(3, 0); |
143 | 482 |
root.Children.Remove(Panel3); |
483 |
Panel3 = null; |
|
484 |
break; |
|
485 |
case 4: |
|
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:
156
diff
changeset
|
486 |
UserControlPivot.ApplyColor(4, 0); |
143 | 487 |
root.Children.Remove(Panel4); |
488 |
Panel4 = null; |
|
489 |
break; |
|
490 |
} |
|
491 |
} |
|
492 |
root.Children.Remove(((UserControlClose)sender)); |
|
493 |
} |
|
77 | 494 |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
495 |
|
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
496 |
//On success annotation Display annotations in the different Panels |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
497 |
private void Panel_OnSuccessAnnotation(object sender, EventArgs e) |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
498 |
{ |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
499 |
UserControlUserPanel PanelAnnotation = (UserControlUserPanel)sender; |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
500 |
int idUser = PanelAnnotation.id; |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
501 |
//Get Color Of User |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
502 |
Brush brushAnnot = new SolidColorBrush((new ColorFactory()).Colors[PanelAnnotation.idcolor]); |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
503 |
//set Color to All Panels |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
504 |
if(Panel1!=null) |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
505 |
Panel1.UserControlSyncSource_DisplayAnnotation(idUser, brushAnnot); |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
506 |
if (Panel2 != null) |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
507 |
Panel2.UserControlSyncSource_DisplayAnnotation(idUser, brushAnnot); |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
508 |
if (Panel3 != null) |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
509 |
Panel3.UserControlSyncSource_DisplayAnnotation(idUser, brushAnnot); |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
510 |
if (Panel4 != null) |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
511 |
Panel4.UserControlSyncSource_DisplayAnnotation(idUser, brushAnnot); |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
512 |
|
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
513 |
|
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
514 |
} |
45 | 515 |
} |
516 |
} |