--- a/src/FingersDance/MainSurfaceWindow.xaml.cs Tue Sep 15 16:09:45 2009 +0200
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs Tue Sep 15 16:57:45 2009 +0200
@@ -15,6 +15,8 @@
using Microsoft.Surface.Presentation;
using Microsoft.Surface.Presentation.Controls;
+using FingersDance.Control.UserPanel;
+
namespace FingersDance
{
/// <summary>
@@ -26,6 +28,12 @@
/// Default constructor.
/// </summary>
///
+ #region Variables
+ private bool isCreatedP1 = false;
+ private bool isCreatedP2 = false;
+ private bool isCreatedP3 = false;
+ private bool isCreatedP4 = false;
+ #endregion
ActionFactory.ActionGenerator _Factory = new FingersDance.ActionFactory.ActionFactory().GetGenerator();
@@ -33,12 +41,24 @@
{
InitializeComponent();
+ //Permet d'initialiser l'inertie du Pivot une fois relaché.
+ InitPivotInertia();
//Permet d'initialiser les quand Grid à la position initiale du pivot
InitGridPositions();
// Add handlers for Application activation events
AddActivationHandlers();
}
+ private void InitPivotInertia()
+ {
+ try
+ {
+ ScatterViewItem item = (ScatterViewItem)ScaterView.Items.GetItemAt(0);
+ item.DecelerationRate = double.NaN;
+ }
+ catch (Exception ex) { }
+ }
+
private void InitGridPositions()
{
//Initialise les 4 Grids à la positions initiale du Pivot.
@@ -135,16 +155,60 @@
Grid1.Width = e.GetPosition(mainSurfaceWindow).X;
Grid1.Height = e.GetPosition(mainSurfaceWindow).Y;
- Grid2.Width = e.GetPosition(mainSurfaceWindow).X;
- Grid2.Height = 768 - e.GetPosition(mainSurfaceWindow).Y;
-
- Grid3.Width = 1024 - e.GetPosition(mainSurfaceWindow).X;
+ Grid3.Width = e.GetPosition(mainSurfaceWindow).X;
Grid3.Height = 768 - e.GetPosition(mainSurfaceWindow).Y;
Grid4.Width = 1024 - e.GetPosition(mainSurfaceWindow).X;
- Grid4.Height = e.GetPosition(mainSurfaceWindow).Y;
+ Grid4.Height = 768 - e.GetPosition(mainSurfaceWindow).Y;
+
+ Grid2.Width = 1024 - e.GetPosition(mainSurfaceWindow).X;
+ Grid2.Height = e.GetPosition(mainSurfaceWindow).Y;
}
catch (Exception ex) { }
}
+
+ private void UserControlPivot_EH_SurfaceButtonPlayer1_ContactDown(object sender, EventArgs e)
+ {
+ if (!isCreatedP1)
+ {
+ UserControlUserPanel UserPanel1 = new UserControlUserPanel();
+ UserPanel1.Name = "UserPanel1";
+ Grid1.Children.Add(UserPanel1);
+ isCreatedP1 = true;
+ }
+ }
+
+ private void UserControlPivot_EH_SurfaceButtonPlayer2_ContactDown(object sender, EventArgs e)
+ {
+ if (!isCreatedP2)
+ {
+ UserControlUserPanel UserPanel2 = new UserControlUserPanel();
+ UserPanel2.Name = "UserPanel2";
+ Grid2.Children.Add(UserPanel2);
+ isCreatedP2 = true;
+ }
+ }
+
+ private void UserControlPivot_EH_SurfaceButtonPlayer3_ContactDown(object sender, EventArgs e)
+ {
+ if (!isCreatedP3)
+ {
+ UserControlUserPanel UserPanel3 = new UserControlUserPanel();
+ UserPanel3.Name = "UserPanel3";
+ Grid3.Children.Add(UserPanel3);
+ isCreatedP3 = true;
+ }
+ }
+
+ private void UserControlPivot_EH_SurfaceButtonPlayer4_ContactDown(object sender, EventArgs e)
+ {
+ if (!isCreatedP4)
+ {
+ UserControlUserPanel UserPanel4 = new UserControlUserPanel();
+ UserPanel4.Name = "UserPanel4";
+ Grid4.Children.Add(UserPanel4);
+ isCreatedP4 = true;
+ }
+ }
}
}
\ No newline at end of file