author | cavaliet |
Wed, 14 Oct 2009 17:08:43 +0200 | |
changeset 150 | 569925b65604 |
parent 148 | c379899e9c94 |
child 152 | 46577fd0a294 |
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; |
|
82 | 23 |
|
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; |
|
143 | 42 |
ActionFactory.ActionGenerator _Factory = new FingersDance.ActionFactory.ActionFactory().GetGenerator(); |
43 |
private MainViewModel _mainviewmodel = new MainViewModel(); |
|
44 |
||
60 | 45 |
#endregion |
54
c724ac229181
Singleton de la factory
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
45
diff
changeset
|
46 |
|
c724ac229181
Singleton de la factory
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
45
diff
changeset
|
47 |
|
143 | 48 |
#region Constructor |
45 | 49 |
public SurfaceWindow1() |
50 |
{ |
|
51 |
InitializeComponent(); |
|
52 |
||
60 | 53 |
//Permet d'initialiser l'inertie du Pivot une fois relach�. |
54 |
InitPivotInertia(); |
|
58
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
55 |
//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
|
56 |
InitGridPositions(); |
45 | 57 |
// Add handlers for Application activation events |
58 |
AddActivationHandlers(); |
|
59 |
} |
|
143 | 60 |
#endregion |
61 |
||
62 |
#region Initialization |
|
45 | 63 |
|
60 | 64 |
private void InitPivotInertia() |
65 |
{ |
|
66 |
try |
|
67 |
{ |
|
77 | 68 |
ScatterViewItem item = (ScatterViewItem)scaterview.Items.GetItemAt(0); |
60 | 69 |
item.DecelerationRate = double.NaN; |
70 |
} |
|
71 |
catch (Exception ex) { } |
|
72 |
} |
|
73 |
||
58
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
74 |
private void InitGridPositions() |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
75 |
{ |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
76 |
//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
|
77 |
try |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
78 |
{ |
77 | 79 |
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
|
80 |
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
|
81 |
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
|
82 |
|
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
83 |
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
|
84 |
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
|
85 |
|
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
86 |
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
|
87 |
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
|
88 |
|
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
89 |
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
|
90 |
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
|
91 |
} |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
92 |
catch (Exception ex) { } |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
93 |
} |
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
94 |
|
143 | 95 |
#endregion |
45 | 96 |
|
97 |
/// <summary> |
|
98 |
/// Occurs when the window is about to close. |
|
99 |
/// </summary> |
|
100 |
/// <param name="e"></param> |
|
101 |
protected override void OnClosed(EventArgs e) |
|
102 |
{ |
|
103 |
base.OnClosed(e); |
|
104 |
||
105 |
// Remove handlers for Application activation events |
|
106 |
RemoveActivationHandlers(); |
|
107 |
} |
|
108 |
||
109 |
/// <summary> |
|
110 |
/// Adds handlers for Application activation events. |
|
111 |
/// </summary> |
|
112 |
private void AddActivationHandlers() |
|
113 |
{ |
|
114 |
// Subscribe to surface application activation events |
|
115 |
ApplicationLauncher.ApplicationActivated += OnApplicationActivated; |
|
116 |
ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed; |
|
117 |
ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated; |
|
118 |
} |
|
119 |
||
120 |
/// <summary> |
|
121 |
/// Removes handlers for Application activation events. |
|
122 |
/// </summary> |
|
123 |
private void RemoveActivationHandlers() |
|
124 |
{ |
|
125 |
// Unsubscribe from surface application activation events |
|
126 |
ApplicationLauncher.ApplicationActivated -= OnApplicationActivated; |
|
127 |
ApplicationLauncher.ApplicationPreviewed -= OnApplicationPreviewed; |
|
128 |
ApplicationLauncher.ApplicationDeactivated -= OnApplicationDeactivated; |
|
129 |
} |
|
130 |
||
131 |
/// <summary> |
|
132 |
/// This is called when application has been activated. |
|
133 |
/// </summary> |
|
134 |
/// <param name="sender"></param> |
|
135 |
/// <param name="e"></param> |
|
136 |
private void OnApplicationActivated(object sender, EventArgs e) |
|
137 |
{ |
|
138 |
//TODO: enable audio, animations here |
|
143 | 139 |
|
45 | 140 |
} |
141 |
||
142 |
/// <summary> |
|
143 |
/// This is called when application is in preview mode. |
|
144 |
/// </summary> |
|
145 |
/// <param name="sender"></param> |
|
146 |
/// <param name="e"></param> |
|
147 |
private void OnApplicationPreviewed(object sender, EventArgs e) |
|
148 |
{ |
|
149 |
//TODO: Disable audio here if it is enabled |
|
150 |
||
151 |
//TODO: optionally enable animations here |
|
152 |
} |
|
153 |
||
154 |
/// <summary> |
|
155 |
/// This is called when application has been deactivated. |
|
156 |
/// </summary> |
|
157 |
/// <param name="sender"></param> |
|
158 |
/// <param name="e"></param> |
|
159 |
private void OnApplicationDeactivated(object sender, EventArgs e) |
|
160 |
{ |
|
161 |
//TODO: disable audio, animations here |
|
162 |
} |
|
163 |
||
143 | 164 |
/// <summary> |
165 |
/// This is called when application has been loaded, we change the orientation |
|
166 |
/// of the application |
|
167 |
/// </summary> |
|
168 |
/// <param name="sender"></param> |
|
169 |
/// <param name="e"></param> |
|
170 |
private void mainSurfaceWindow_Loaded(object sender, RoutedEventArgs e) |
|
171 |
{ |
|
172 |
||
173 |
if (ApplicationLauncher.InitialOrientation == UserOrientation.Top) |
|
174 |
{ |
|
175 |
// Rotate the main canvas by 180 degrees. |
|
176 |
this.MainGrid.LayoutTransform = new RotateTransform(180.0); |
|
177 |
} |
|
178 |
else |
|
179 |
{ |
|
180 |
// Remove the rotate transform on the main canvas. |
|
181 |
this.MainGrid.LayoutTransform = null; |
|
182 |
} |
|
183 |
// Dismiss the loading screen. |
|
184 |
ApplicationLauncher.SignalApplicationLoadComplete(); |
|
185 |
} |
|
186 |
||
77 | 187 |
private void scaterview_ContactChanged(object sender, ContactEventArgs e) |
112 | 188 |
{ } |
77 | 189 |
|
190 |
private void ScatterViewItemPivot_ContactChanged(object sender, ContactEventArgs e) |
|
45 | 191 |
{ |
58
d7313fb1806c
Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents:
54
diff
changeset
|
192 |
//Permet la MAJ des 4 Grids � la position du pivot |
45 | 193 |
try |
194 |
{ |
|
195 |
Grid1.Width = e.GetPosition(mainSurfaceWindow).X; |
|
196 |
Grid1.Height = e.GetPosition(mainSurfaceWindow).Y; |
|
197 |
||
60 | 198 |
Grid3.Width = e.GetPosition(mainSurfaceWindow).X; |
45 | 199 |
Grid3.Height = 768 - e.GetPosition(mainSurfaceWindow).Y; |
200 |
||
201 |
Grid4.Width = 1024 - e.GetPosition(mainSurfaceWindow).X; |
|
60 | 202 |
Grid4.Height = 768 - e.GetPosition(mainSurfaceWindow).Y; |
203 |
||
204 |
Grid2.Width = 1024 - e.GetPosition(mainSurfaceWindow).X; |
|
205 |
Grid2.Height = e.GetPosition(mainSurfaceWindow).Y; |
|
89 | 206 |
|
91 | 207 |
//GRISAGE |
208 |
//Grid1 |
|
209 |
if (Grid1.Width < (1024 / 4) || Grid2.Height < (768 / 4)) |
|
89 | 210 |
{ |
91 | 211 |
try |
212 |
{Grid1.Children[1].Visibility = Visibility.Hidden;} |
|
213 |
catch (Exception) { } |
|
89 | 214 |
} |
91 | 215 |
else |
216 |
{ |
|
217 |
try |
|
218 |
{ Grid1.Children[1].Visibility = Visibility.Visible; } |
|
219 |
catch (Exception) { } |
|
220 |
} |
|
221 |
//Grid2 |
|
222 |
if (Grid2.Width < (1024 / 4) || Grid2.Height < (768 / 4)) |
|
89 | 223 |
{ |
91 | 224 |
try |
225 |
{ Grid2.Children[1].Visibility = Visibility.Hidden; } |
|
226 |
catch (Exception) { } |
|
227 |
} |
|
228 |
else |
|
229 |
{ |
|
230 |
try |
|
231 |
{ Grid2.Children[1].Visibility = Visibility.Visible; } |
|
232 |
catch (Exception) { } |
|
89 | 233 |
} |
91 | 234 |
//Grid3 |
235 |
if (Grid3.Width < (1024 / 4) || Grid3.Height < (768 / 4)) |
|
89 | 236 |
{ |
91 | 237 |
try |
238 |
{ Grid3.Children[1].Visibility = Visibility.Hidden; } |
|
239 |
catch (Exception) { } |
|
240 |
} |
|
241 |
else |
|
242 |
{ |
|
243 |
try |
|
244 |
{ Grid3.Children[1].Visibility = Visibility.Visible; } |
|
245 |
catch (Exception) { } |
|
89 | 246 |
} |
91 | 247 |
//Grid4 |
248 |
if (Grid4.Width < (1024 / 4) || Grid4.Height < (768 / 4)) |
|
89 | 249 |
{ |
91 | 250 |
try |
251 |
{ Grid4.Children[1].Visibility = Visibility.Hidden; } |
|
252 |
catch (Exception) { } |
|
89 | 253 |
} |
91 | 254 |
else |
255 |
{ |
|
256 |
try |
|
257 |
{ Grid4.Children[1].Visibility = Visibility.Visible; } |
|
258 |
catch (Exception) { } |
|
259 |
} |
|
45 | 260 |
} |
91 | 261 |
catch (Exception) { } |
45 | 262 |
} |
60 | 263 |
|
112 | 264 |
private void UserControlPivot_EH_SurfaceButtonPlayer_ContactDown(object sender, EventArgs e) |
60 | 265 |
{ |
143 | 266 |
// Si aucune video n'a �t� s�lectionn�e et qu'une grid contient un �l�ment (listvideo), on ne fait rien |
267 |
if (_mainviewmodel.Session.VideoPath.Equals("") && (Grid1.Children.Count == 2 || Grid2.Children.Count == 2 || Grid3.Children.Count == 2 || Grid4.Children.Count == 2)) |
|
268 |
return; |
|
269 |
||
270 |
// Traitement du contact down sur le pivot (Cr�ation d'un screen ou suppression d'un panel |
|
112 | 271 |
switch ((int)sender) |
60 | 272 |
{ |
112 | 273 |
case 1: |
143 | 274 |
if (Panel1 == null && Grid1.Children.Count == 1) |
112 | 275 |
{ |
276 |
//1-Creation du control Screen |
|
143 | 277 |
UserControlScreen Screen = new UserControlScreen(1, _mainviewmodel); |
112 | 278 |
Screen.Name = "Screen1"; |
279 |
Screen.contexteGrid = Grid1.Name.ToString(); |
|
280 |
//2-Rajout du screen dans la grid correspondante |
|
281 |
Grid1.Children.Add(Screen); |
|
282 |
||
283 |
Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
|
284 |
} |
|
143 | 285 |
else //Affichage du message de confirmation |
286 |
{ |
|
287 |
if (Panel1 != null && Grid1.Children.Count == 2) |
|
288 |
{ |
|
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
|
289 |
UserControlClose UCclose = new UserControlClose(1, "�tes-vous s�r de vouloir quitter ?"); |
143 | 290 |
UCclose.Name = "CloseAlert1"; |
291 |
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
|
292 |
UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown); |
143 | 293 |
} |
294 |
} |
|
112 | 295 |
break; |
296 |
case 2: |
|
143 | 297 |
if (Panel2 == null && Grid2.Children.Count == 1) |
112 | 298 |
{ |
299 |
//1-Creation du control Screen |
|
143 | 300 |
UserControlScreen Screen = new UserControlScreen(2, _mainviewmodel); |
112 | 301 |
Screen.Name = "Screen2"; |
302 |
Screen.contexteGrid = Grid2.Name.ToString(); |
|
303 |
//2-Rajout du screen dans la grid correspondante |
|
304 |
Grid2.Children.Add(Screen); |
|
72
f1ca0958c992
Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents:
60
diff
changeset
|
305 |
|
112 | 306 |
Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
307 |
} |
|
143 | 308 |
else //Affichage du message de confirmation |
309 |
{ |
|
310 |
if (Panel2 != null && Grid2.Children.Count == 2) |
|
311 |
{ |
|
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
|
312 |
UserControlClose UCclose = new UserControlClose(2, "�tes-vous s�r de vouloir quitter ?"); |
143 | 313 |
UCclose.Name = "CloseAlert2"; |
314 |
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
|
315 |
UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown); |
143 | 316 |
} |
317 |
} |
|
112 | 318 |
break; |
319 |
case 3: |
|
143 | 320 |
if (Panel3 == null && Grid3.Children.Count == 1) |
112 | 321 |
{ |
322 |
//1-Creation du control Screen |
|
143 | 323 |
UserControlScreen Screen = new UserControlScreen(3, _mainviewmodel); |
112 | 324 |
Screen.Name = "Screen3"; |
325 |
Screen.contexteGrid = Grid3.Name.ToString(); |
|
326 |
//2-Rajout du screen dans la grid correspondante |
|
327 |
Grid3.Children.Add(Screen); |
|
72
f1ca0958c992
Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents:
60
diff
changeset
|
328 |
|
112 | 329 |
Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
330 |
} |
|
143 | 331 |
else //Affichage du message de confirmation |
332 |
{ |
|
333 |
if (Panel3 != null && Grid3.Children.Count == 2) |
|
334 |
{ |
|
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
|
335 |
UserControlClose UCclose = new UserControlClose(3, "�tes-vous s�r de vouloir quitter ?"); |
143 | 336 |
UCclose.Name = "CloseAlert3"; |
337 |
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
|
338 |
UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown); |
143 | 339 |
} |
340 |
} |
|
112 | 341 |
break; |
342 |
case 4: |
|
143 | 343 |
if (Panel4 == null && Grid4.Children.Count == 1) |
112 | 344 |
{ |
345 |
//1-Creation du control Screen |
|
143 | 346 |
UserControlScreen Screen = new UserControlScreen(4, _mainviewmodel); |
112 | 347 |
Screen.Name = "Screen4"; |
348 |
Screen.contexteGrid = Grid4.Name.ToString(); |
|
349 |
//2-Rajout du screen dans la grid correspondante |
|
350 |
Grid4.Children.Add(Screen); |
|
351 |
||
352 |
Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
|
353 |
} |
|
143 | 354 |
else //Affichage du message de confirmation |
355 |
{ |
|
356 |
if (Panel4 != null && Grid4.Children.Count == 2) |
|
357 |
{ |
|
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
|
358 |
UserControlClose UCclose = new UserControlClose(4, "�tes-vous s�r de vouloir quitter ?"); |
143 | 359 |
UCclose.Name = "CloseAlert4"; |
360 |
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
|
361 |
UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown); |
143 | 362 |
} |
363 |
} |
|
112 | 364 |
break; |
365 |
} |
|
366 |
|
|
73 | 367 |
} |
72
f1ca0958c992
Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents:
60
diff
changeset
|
368 |
|
73 | 369 |
//Button Submit du control SessionInput |
370 |
private void SessionInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e) |
|
371 |
{ |
|
372 |
try |
|
373 |
{ |
|
112 | 374 |
//1-Suppression du UC Screen |
104 | 375 |
Grid root = (Grid)(((UserControlScreen)sender).Parent); |
376 |
root.Children.Remove(((UserControlScreen)sender)); |
|
112 | 377 |
//2-Creation du User Panel |
148 | 378 |
Project newProject = ((UserControlScreen)sender).Project.Project; |
143 | 379 |
|
380 |
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))) |
|
381 |
return; |
|
382 |
||
112 | 383 |
switch (((UserControlScreen)sender).id) |
384 |
{ |
|
385 |
case 1: |
|
150
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
148
diff
changeset
|
386 |
Panel1 = new UserControlUserPanel(1, 0xFF5A0FC8, newProject, _mainviewmodel.Session.VideoPath); |
112 | 387 |
Panel1.Name = "UserPanel1"; |
388 |
//3-Rajout sur la Grid Root |
|
389 |
root.Children.Add(Panel1); |
|
390 |
break; |
|
391 |
case 2: |
|
150
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
148
diff
changeset
|
392 |
Panel2 = new UserControlUserPanel(2, 0xFFC80FA0, newProject, _mainviewmodel.Session.VideoPath); |
112 | 393 |
Panel2.Name = "UserPanel2"; |
394 |
//3-Rajout sur la Grid Root |
|
395 |
root.Children.Add(Panel2); |
|
396 |
break; |
|
397 |
case 3: |
|
150
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
148
diff
changeset
|
398 |
Panel3 = new UserControlUserPanel(3, 0xFFFFFF00, newProject, _mainviewmodel.Session.VideoPath); |
112 | 399 |
Panel3.Name = "UserPanel3"; |
400 |
//3-Rajout sur la Grid Root |
|
401 |
root.Children.Add(Panel3); |
|
402 |
break; |
|
403 |
case 4: |
|
150
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
148
diff
changeset
|
404 |
Panel4 = new UserControlUserPanel(4, 0xFF0096FF, newProject, _mainviewmodel.Session.VideoPath); |
112 | 405 |
Panel4.Name = "UserPanel4"; |
406 |
//3-Rajout sur la Grid Root |
|
407 |
root.Children.Add(Panel4); |
|
408 |
break; |
|
409 |
} |
|
73 | 410 |
} |
411 |
catch (Exception ex) { } |
|
72
f1ca0958c992
Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents:
60
diff
changeset
|
412 |
} |
73 | 413 |
|
143 | 414 |
//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
|
415 |
private void CloseAlert_EH_SurfaceButton_ContactDown(object sender, ConfirmEventArgs e) |
143 | 416 |
{ |
417 |
Grid root = (Grid)(((UserControlClose)sender).Parent); |
|
141
923687896770
UserControlClose more readable and MainSurfaceWindow now uses the ConfirmYesOrNo event.
cavaliet
parents:
140
diff
changeset
|
418 |
if(e.Confirmed==true) |
143 | 419 |
{ |
141
923687896770
UserControlClose more readable and MainSurfaceWindow now uses the ConfirmYesOrNo event.
cavaliet
parents:
140
diff
changeset
|
420 |
switch(e.PanelNumber) |
143 | 421 |
{ |
422 |
case 1: |
|
423 |
root.Children.Remove(Panel1); |
|
424 |
Panel1 = null; |
|
425 |
break; |
|
426 |
case 2: |
|
427 |
root.Children.Remove(Panel2); |
|
428 |
Panel2 = null; |
|
429 |
break; |
|
430 |
case 3: |
|
431 |
root.Children.Remove(Panel3); |
|
432 |
Panel3 = null; |
|
433 |
break; |
|
434 |
case 4: |
|
435 |
root.Children.Remove(Panel4); |
|
436 |
Panel4 = null; |
|
437 |
break; |
|
438 |
} |
|
439 |
} |
|
440 |
root.Children.Remove(((UserControlClose)sender)); |
|
441 |
} |
|
77 | 442 |
|
45 | 443 |
} |
444 |
} |