author | cavaliet |
Fri, 16 Oct 2009 15:56:09 +0200 | |
changeset 160 | e940ca798fe3 |
parent 156 | e16c8c913c65 |
child 162 | 0b9f989bcb37 |
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(); |
143 | 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 |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
212 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
213 |
if (Panel1 != null) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
214 |
Panel1.PlayerPause(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
215 |
Grid1.Children[1].Visibility = Visibility.Hidden; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
216 |
} |
91 | 217 |
catch (Exception) { } |
89 | 218 |
} |
91 | 219 |
else |
220 |
{ |
|
221 |
try |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
222 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
223 |
Grid1.Children[1].Visibility = Visibility.Visible; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
224 |
} |
91 | 225 |
catch (Exception) { } |
226 |
} |
|
227 |
//Grid2 |
|
228 |
if (Grid2.Width < (1024 / 4) || Grid2.Height < (768 / 4)) |
|
89 | 229 |
{ |
91 | 230 |
try |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
231 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
232 |
if (Panel2 != null) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
233 |
Panel2.PlayerPause(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
234 |
Grid2.Children[1].Visibility = Visibility.Hidden; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
235 |
} |
91 | 236 |
catch (Exception) { } |
237 |
} |
|
238 |
else |
|
239 |
{ |
|
240 |
try |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
241 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
242 |
Grid2.Children[1].Visibility = Visibility.Visible; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
243 |
} |
91 | 244 |
catch (Exception) { } |
89 | 245 |
} |
91 | 246 |
//Grid3 |
247 |
if (Grid3.Width < (1024 / 4) || Grid3.Height < (768 / 4)) |
|
89 | 248 |
{ |
91 | 249 |
try |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
250 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
251 |
if (Panel3 != null) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
252 |
Panel3.PlayerPause(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
253 |
Grid3.Children[1].Visibility = Visibility.Hidden; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
254 |
} |
91 | 255 |
catch (Exception) { } |
256 |
} |
|
257 |
else |
|
258 |
{ |
|
259 |
try |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
260 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
261 |
Grid3.Children[1].Visibility = Visibility.Visible; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
262 |
} |
91 | 263 |
catch (Exception) { } |
89 | 264 |
} |
91 | 265 |
//Grid4 |
266 |
if (Grid4.Width < (1024 / 4) || Grid4.Height < (768 / 4)) |
|
89 | 267 |
{ |
91 | 268 |
try |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
269 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
270 |
if (Panel4 != null) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
271 |
Panel4.PlayerPause(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
272 |
Grid4.Children[1].Visibility = Visibility.Hidden; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
273 |
} |
91 | 274 |
catch (Exception) { } |
89 | 275 |
} |
91 | 276 |
else |
277 |
{ |
|
278 |
try |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
279 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
280 |
Grid4.Children[1].Visibility = Visibility.Visible; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
281 |
} |
91 | 282 |
catch (Exception) { } |
283 |
} |
|
45 | 284 |
} |
91 | 285 |
catch (Exception) { } |
45 | 286 |
} |
60 | 287 |
|
112 | 288 |
private void UserControlPivot_EH_SurfaceButtonPlayer_ContactDown(object sender, EventArgs e) |
60 | 289 |
{ |
143 | 290 |
// 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
|
291 |
if (_mainviewmodel.Session.Name.Equals("") && (Grid1.Children.Count == 2 || Grid2.Children.Count == 2 || Grid3.Children.Count == 2 || Grid4.Children.Count == 2)) |
143 | 292 |
return; |
293 |
||
294 |
// Traitement du contact down sur le pivot (Cr�ation d'un screen ou suppression d'un panel |
|
112 | 295 |
switch ((int)sender) |
60 | 296 |
{ |
112 | 297 |
case 1: |
143 | 298 |
if (Panel1 == null && Grid1.Children.Count == 1) |
112 | 299 |
{ |
300 |
//1-Creation du control Screen |
|
143 | 301 |
UserControlScreen Screen = new UserControlScreen(1, _mainviewmodel); |
112 | 302 |
Screen.Name = "Screen1"; |
303 |
Screen.contexteGrid = Grid1.Name.ToString(); |
|
304 |
//2-Rajout du screen dans la grid correspondante |
|
305 |
Grid1.Children.Add(Screen); |
|
306 |
||
307 |
Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
|
308 |
} |
|
143 | 309 |
else //Affichage du message de confirmation |
310 |
{ |
|
311 |
if (Panel1 != null && Grid1.Children.Count == 2) |
|
312 |
{ |
|
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
|
313 |
UserControlClose UCclose = new UserControlClose(1, "�tes-vous s�r de vouloir quitter ?"); |
143 | 314 |
UCclose.Name = "CloseAlert1"; |
315 |
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
|
316 |
UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown); |
143 | 317 |
} |
318 |
} |
|
112 | 319 |
break; |
320 |
case 2: |
|
143 | 321 |
if (Panel2 == null && Grid2.Children.Count == 1) |
112 | 322 |
{ |
323 |
//1-Creation du control Screen |
|
143 | 324 |
UserControlScreen Screen = new UserControlScreen(2, _mainviewmodel); |
112 | 325 |
Screen.Name = "Screen2"; |
326 |
Screen.contexteGrid = Grid2.Name.ToString(); |
|
327 |
//2-Rajout du screen dans la grid correspondante |
|
328 |
Grid2.Children.Add(Screen); |
|
72
f1ca0958c992
Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents:
60
diff
changeset
|
329 |
|
112 | 330 |
Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
331 |
} |
|
143 | 332 |
else //Affichage du message de confirmation |
333 |
{ |
|
334 |
if (Panel2 != null && Grid2.Children.Count == 2) |
|
335 |
{ |
|
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
|
336 |
UserControlClose UCclose = new UserControlClose(2, "�tes-vous s�r de vouloir quitter ?"); |
143 | 337 |
UCclose.Name = "CloseAlert2"; |
338 |
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
|
339 |
UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown); |
143 | 340 |
} |
341 |
} |
|
112 | 342 |
break; |
343 |
case 3: |
|
143 | 344 |
if (Panel3 == null && Grid3.Children.Count == 1) |
112 | 345 |
{ |
346 |
//1-Creation du control Screen |
|
143 | 347 |
UserControlScreen Screen = new UserControlScreen(3, _mainviewmodel); |
112 | 348 |
Screen.Name = "Screen3"; |
349 |
Screen.contexteGrid = Grid3.Name.ToString(); |
|
350 |
//2-Rajout du screen dans la grid correspondante |
|
351 |
Grid3.Children.Add(Screen); |
|
72
f1ca0958c992
Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents:
60
diff
changeset
|
352 |
|
112 | 353 |
Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
354 |
} |
|
143 | 355 |
else //Affichage du message de confirmation |
356 |
{ |
|
357 |
if (Panel3 != null && Grid3.Children.Count == 2) |
|
358 |
{ |
|
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
|
359 |
UserControlClose UCclose = new UserControlClose(3, "�tes-vous s�r de vouloir quitter ?"); |
143 | 360 |
UCclose.Name = "CloseAlert3"; |
361 |
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
|
362 |
UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown); |
143 | 363 |
} |
364 |
} |
|
112 | 365 |
break; |
366 |
case 4: |
|
143 | 367 |
if (Panel4 == null && Grid4.Children.Count == 1) |
112 | 368 |
{ |
369 |
//1-Creation du control Screen |
|
143 | 370 |
UserControlScreen Screen = new UserControlScreen(4, _mainviewmodel); |
112 | 371 |
Screen.Name = "Screen4"; |
372 |
Screen.contexteGrid = Grid4.Name.ToString(); |
|
373 |
//2-Rajout du screen dans la grid correspondante |
|
374 |
Grid4.Children.Add(Screen); |
|
375 |
||
376 |
Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); |
|
377 |
} |
|
143 | 378 |
else //Affichage du message de confirmation |
379 |
{ |
|
380 |
if (Panel4 != null && Grid4.Children.Count == 2) |
|
381 |
{ |
|
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
|
382 |
UserControlClose UCclose = new UserControlClose(4, "�tes-vous s�r de vouloir quitter ?"); |
143 | 383 |
UCclose.Name = "CloseAlert4"; |
384 |
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
|
385 |
UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown); |
143 | 386 |
} |
387 |
} |
|
112 | 388 |
break; |
389 |
} |
|
390 |
|
|
73 | 391 |
} |
72
f1ca0958c992
Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents:
60
diff
changeset
|
392 |
|
73 | 393 |
//Button Submit du control SessionInput |
394 |
private void SessionInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e) |
|
395 |
{ |
|
396 |
try |
|
397 |
{ |
|
112 | 398 |
//1-Suppression du UC Screen |
104 | 399 |
Grid root = (Grid)(((UserControlScreen)sender).Parent); |
400 |
root.Children.Remove(((UserControlScreen)sender)); |
|
143 | 401 |
|
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
402 |
if (((UserControlScreen)sender).Project != null) |
112 | 403 |
{ |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
404 |
//2-Creation du User Panel |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
405 |
Project newProject = ((UserControlScreen)sender).Project.Project; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
406 |
|
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
407 |
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
|
408 |
return; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
409 |
|
156
e16c8c913c65
Color Factory et application des couleurs au pivot
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
152
diff
changeset
|
410 |
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
|
411 |
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
|
412 |
switch (((UserControlScreen)sender).id) |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
413 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
414 |
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
|
415 |
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
|
416 |
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
|
417 |
Panel1.Name = "UserPanel1"; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
418 |
//3-Rajout sur la Grid Root |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
419 |
root.Children.Add(Panel1); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
420 |
break; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
421 |
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
|
422 |
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
|
423 |
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
|
424 |
Panel2.Name = "UserPanel2"; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
425 |
//3-Rajout sur la Grid Root |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
426 |
root.Children.Add(Panel2); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
427 |
break; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
428 |
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
|
429 |
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
|
430 |
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
|
431 |
Panel3.Name = "UserPanel3"; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
432 |
//3-Rajout sur la Grid Root |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
433 |
root.Children.Add(Panel3); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
434 |
break; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
435 |
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
|
436 |
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
|
437 |
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
|
438 |
Panel4.Name = "UserPanel4"; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
439 |
//3-Rajout sur la Grid Root |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
440 |
root.Children.Add(Panel4); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
441 |
break; |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
442 |
} |
112 | 443 |
} |
73 | 444 |
} |
445 |
catch (Exception ex) { } |
|
72
f1ca0958c992
Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents:
60
diff
changeset
|
446 |
} |
73 | 447 |
|
143 | 448 |
//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
|
449 |
private void CloseAlert_EH_SurfaceButton_ContactDown(object sender, ConfirmEventArgs e) |
143 | 450 |
{ |
451 |
Grid root = (Grid)(((UserControlClose)sender).Parent); |
|
141
923687896770
UserControlClose more readable and MainSurfaceWindow now uses the ConfirmYesOrNo event.
cavaliet
parents:
140
diff
changeset
|
452 |
if(e.Confirmed==true) |
143 | 453 |
{ |
141
923687896770
UserControlClose more readable and MainSurfaceWindow now uses the ConfirmYesOrNo event.
cavaliet
parents:
140
diff
changeset
|
454 |
switch(e.PanelNumber) |
143 | 455 |
{ |
456 |
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
|
457 |
UserControlPivot.ApplyColor(1, 0); |
143 | 458 |
root.Children.Remove(Panel1); |
459 |
Panel1 = null; |
|
460 |
break; |
|
461 |
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
|
462 |
UserControlPivot.ApplyColor(2, 0); |
143 | 463 |
root.Children.Remove(Panel2); |
464 |
Panel2 = null; |
|
465 |
break; |
|
466 |
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
|
467 |
UserControlPivot.ApplyColor(3, 0); |
143 | 468 |
root.Children.Remove(Panel3); |
469 |
Panel3 = null; |
|
470 |
break; |
|
471 |
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
|
472 |
UserControlPivot.ApplyColor(4, 0); |
143 | 473 |
root.Children.Remove(Panel4); |
474 |
Panel4 = null; |
|
475 |
break; |
|
476 |
} |
|
477 |
} |
|
478 |
root.Children.Remove(((UserControlClose)sender)); |
|
479 |
} |
|
77 | 480 |
|
45 | 481 |
} |
482 |
} |