Merge
authorPAMPHILE Jonathan <pamphile@efrei.fr>
Thu, 24 Sep 2009 17:39:19 +0200
changeset 113 3c9ebcf59e64
parent 112 08bc8eac9e71 (diff)
parent 111 168048e2f1bc (current diff)
child 114 8262d9756231
Merge
src/FingersDance/FingersDance.csproj
--- a/src/FingersDance.Control.Pivot/UserControlPivot.xaml.cs	Thu Sep 24 17:31:34 2009 +0200
+++ b/src/FingersDance.Control.Pivot/UserControlPivot.xaml.cs	Thu Sep 24 17:39:19 2009 +0200
@@ -13,10 +13,7 @@
 	public partial class UserControlPivot
 	{
         //Events pour chaque Boutton du Pivot
-        public event EventHandler EH_SurfaceButtonPlayer1_ContactDown;
-        public event EventHandler EH_SurfaceButtonPlayer2_ContactDown;
-        public event EventHandler EH_SurfaceButtonPlayer3_ContactDown;
-        public event EventHandler EH_SurfaceButtonPlayer4_ContactDown;
+        public event EventHandler EH_SurfaceButtonPlayer_ContactDown;
 
 		public UserControlPivot()
 		{
@@ -27,26 +24,26 @@
 
         private void SurfaceButtonPlayer1_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
         {
-            if(EH_SurfaceButtonPlayer1_ContactDown!=null)
-                EH_SurfaceButtonPlayer1_ContactDown(this, new EventArgs());
+            if(EH_SurfaceButtonPlayer_ContactDown!=null)
+                EH_SurfaceButtonPlayer_ContactDown(1, new EventArgs());
         }
 
         private void SurfaceButtonPlayer2_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
         {
-            if (EH_SurfaceButtonPlayer2_ContactDown != null)
-                EH_SurfaceButtonPlayer2_ContactDown(this, new EventArgs());
+            if (EH_SurfaceButtonPlayer_ContactDown != null)
+                EH_SurfaceButtonPlayer_ContactDown(2, new EventArgs());
         }
 
         private void SurfaceButtonPlayer3_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
         {
-            if (EH_SurfaceButtonPlayer3_ContactDown != null)
-                EH_SurfaceButtonPlayer3_ContactDown(this, new EventArgs());
+            if (EH_SurfaceButtonPlayer_ContactDown != null)
+                EH_SurfaceButtonPlayer_ContactDown(3, new EventArgs());
         }
 
         private void SurfaceButtonPlayer4_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
         {
-            if (EH_SurfaceButtonPlayer4_ContactDown != null)
-                EH_SurfaceButtonPlayer4_ContactDown(this, new EventArgs());
+            if (EH_SurfaceButtonPlayer_ContactDown != null)
+                EH_SurfaceButtonPlayer_ContactDown(4, new EventArgs());
         }
 
         private void SurfaceButtonPlayer1_Click(object sender, RoutedEventArgs e)
--- a/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs	Thu Sep 24 17:31:34 2009 +0200
+++ b/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs	Thu Sep 24 17:39:19 2009 +0200
@@ -16,12 +16,13 @@
 	{
         public String contexteGrid;
         public string Path = "";
+        public int id = 0;
         public event EventHandler UC_Screen_NewSession;
 
-		public UserControlScreen()
+		public UserControlScreen(int id)
 		{
 			this.InitializeComponent();
-            
+            this.id = id;
             //1-Creation de la ListVideo
             UserControlListVideo ListVideo = new UserControlListVideo();
             ListVideo.Name = "ListVideo1";
--- a/src/FingersDance/FingersDance.csproj	Thu Sep 24 17:31:34 2009 +0200
+++ b/src/FingersDance/FingersDance.csproj	Thu Sep 24 17:39:19 2009 +0200
@@ -153,6 +153,10 @@
       <Project>{C7B905EA-0678-4DA0-8EF8-7F9CBD22818E}</Project>
       <Name>FingersDance.ActionFactory</Name>
     </ProjectReference>
+    <ProjectReference Include="..\FingersDance.Control.Menu\FingersDance.Control.Menu.csproj">
+      <Project>{6960F7ED-3D82-4BCE-AB88-D31D6C72F2B6}</Project>
+      <Name>FingersDance.Control.Menu</Name>
+    </ProjectReference>
     <ProjectReference Include="..\FingersDance.Control.Pivot\FingersDance.Control.Pivot.csproj">
       <Project>{0EC4C48C-132C-4926-9A09-A4135C58688C}</Project>
       <Name>FingersDance.Control.Pivot</Name>
--- a/src/FingersDance/MainSurfaceWindow.xaml	Thu Sep 24 17:31:34 2009 +0200
+++ b/src/FingersDance/MainSurfaceWindow.xaml	Thu Sep 24 17:39:19 2009 +0200
@@ -177,7 +177,7 @@
   	</Grid>
   	<s:ScatterView x:Name="scaterview"  ContactChanged="scaterview_ContactChanged">
   		<s:ScatterViewItem   Center="512,384" CanMove="True" CanRotate="False" CanScale="False" Background="{x:Null}" x:Name="ScatterViewItemPivot" ContactChanged="ScatterViewItemPivot_ContactChanged" Style="{DynamicResource FingersDance.Control.ScatterView}" BorderBrush="{x:Null}" Foreground="{x:Null}" >
-  			<FingersDance_Control_Pivot:UserControlPivot x:Name="UserControlPivot" EH_SurfaceButtonPlayer1_ContactDown="UserControlPivot_EH_SurfaceButtonPlayer1_ContactDown" EH_SurfaceButtonPlayer2_ContactDown="UserControlPivot_EH_SurfaceButtonPlayer2_ContactDown" EH_SurfaceButtonPlayer3_ContactDown="UserControlPivot_EH_SurfaceButtonPlayer3_ContactDown" EH_SurfaceButtonPlayer4_ContactDown="UserControlPivot_EH_SurfaceButtonPlayer4_ContactDown"/>
+  			<FingersDance_Control_Pivot:UserControlPivot x:Name="UserControlPivot" EH_SurfaceButtonPlayer_ContactDown="UserControlPivot_EH_SurfaceButtonPlayer_ContactDown"/>
   		</s:ScatterViewItem>
   	</s:ScatterView>
 
--- a/src/FingersDance/MainSurfaceWindow.xaml.cs	Thu Sep 24 17:31:34 2009 +0200
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs	Thu Sep 24 17:39:19 2009 +0200
@@ -31,10 +31,10 @@
         /// </summary>
         /// 
         #region Variables
-        private bool isCreatedP1 = false;
-        private bool isCreatedP2 = false;
-        private bool isCreatedP3 = false;
-        private bool isCreatedP4 = false;
+        private UserControlUserPanel Panel1 = null;
+        private UserControlUserPanel Panel2 = null;
+        private UserControlUserPanel Panel3 = null;
+        private UserControlUserPanel Panel4 = null;
         #endregion
 
         ActionFactory.ActionGenerator _Factory = new FingersDance.ActionFactory.ActionFactory().GetGenerator();
@@ -150,24 +150,7 @@
         }
 
         private void scaterview_ContactChanged(object sender, ContactEventArgs e)
-        {
-            //Permet la MAJ des 4 Grids à la position du pivot
-            /*try
-            {
-                Grid1.Width = e.GetPosition(mainSurfaceWindow).X;
-                Grid1.Height = e.GetPosition(mainSurfaceWindow).Y;
-
-                Grid3.Width = e.GetPosition(mainSurfaceWindow).X;
-                Grid3.Height = 768 - e.GetPosition(mainSurfaceWindow).Y;
-
-                Grid4.Width = 1024 - e.GetPosition(mainSurfaceWindow).X;
-                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 ScatterViewItemPivot_ContactChanged(object sender, ContactEventArgs e)
         {
@@ -243,57 +226,64 @@
             catch (Exception) { }
         }
 
-        private void UserControlPivot_EH_SurfaceButtonPlayer1_ContactDown(object sender, EventArgs e)
-        {
-            
-            if (!isCreatedP1)
-            {
-                //1-Creation du control Screen
-                UserControlScreen Screen1 = new UserControlScreen();
-                Screen1.Name = "Screen1";
-                Screen1.contexteGrid = Grid1.Name.ToString();
-                //2-Rajout du screen dans la grid correspondante
-                Grid1.Children.Add(Screen1);
-
-                Screen1.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
-            }            
-        }
-
-        private void UserControlPivot_EH_SurfaceButtonPlayer2_ContactDown(object sender, EventArgs e)
-        {
-            if (!isCreatedP2)
-            {
-               
-            } 
-        }
-
-        private void UserControlPivot_EH_SurfaceButtonPlayer3_ContactDown(object sender, EventArgs e)
+        private void UserControlPivot_EH_SurfaceButtonPlayer_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)
+            switch ((int)sender)
             {
-                UserControlUserPanel UserPanel4 = new UserControlUserPanel();
-                UserPanel4.Name = "UserPanel4";
-                Grid4.Children.Add(UserPanel4);
-                isCreatedP4 = true;
-            } 
-        }
+                case 1:
+                    if (Panel1 == null)
+                    {
+                        //1-Creation du control Screen
+                        UserControlScreen Screen = new UserControlScreen(1);
+                        Screen.Name = "Screen1";
+                        Screen.contexteGrid = Grid1.Name.ToString();
+                        //2-Rajout du screen dans la grid correspondante
+                        Grid1.Children.Add(Screen);
+
+                        Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
+                    }
+                    break;
+                case 2:
+                    if (Panel2 == null)
+                    {
+                        //1-Creation du control Screen
+                        UserControlScreen Screen = new UserControlScreen(2);
+                        Screen.Name = "Screen2";
+                        Screen.contexteGrid = Grid2.Name.ToString();
+                        //2-Rajout du screen dans la grid correspondante
+                        Grid2.Children.Add(Screen);
 
-        
+                        Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
+                    }
+                    break;
+                case 3:
+                    if (Panel3 == null)
+                    {
+                        //1-Creation du control Screen
+                        UserControlScreen Screen = new UserControlScreen(3);
+                        Screen.Name = "Screen3";
+                        Screen.contexteGrid = Grid3.Name.ToString();
+                        //2-Rajout du screen dans la grid correspondante
+                        Grid3.Children.Add(Screen);
 
-        private void ListVideo1_EH_ItemVideo2_ContactDown(object sender, EventArgs e)
-        {
-            //ToDo
+                        Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
+                    }
+                    break;
+                case 4:
+                    if (Panel4 == null)
+                    {
+                        //1-Creation du control Screen
+                        UserControlScreen Screen = new UserControlScreen(4);
+                        Screen.Name = "Screen4";
+                        Screen.contexteGrid = Grid4.Name.ToString();
+                        //2-Rajout du screen dans la grid correspondante
+                        Grid4.Children.Add(Screen);
+
+                        Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
+                    }
+                    break;
+            }
+                        
         }
 
         //Button Submit du control SessionInput
@@ -301,15 +291,37 @@
         {
             try
             {
-                //3-Suppression du UC Screen
+                //1-Suppression du UC Screen
                 Grid root = (Grid)(((UserControlScreen)sender).Parent);
                 root.Children.Remove(((UserControlScreen)sender));
-                //4-Creation du User Panel
-                UserControlUserPanel UserPanel1 = new UserControlUserPanel();
-                UserPanel1.Name = "UserPanel1";
-                //5-Rajout sur la Grid Root
-                root.Children.Add(UserPanel1);
-                
+                //2-Creation du User Panel
+                switch (((UserControlScreen)sender).id)
+                {
+                    case 1:
+                        Panel1 = new UserControlUserPanel();
+                        Panel1.Name = "UserPanel1";
+                        //3-Rajout sur la Grid Root
+                        root.Children.Add(Panel1);
+                        break;
+                    case 2:
+                        Panel2 = new UserControlUserPanel();
+                        Panel2.Name = "UserPanel2";
+                        //3-Rajout sur la Grid Root
+                        root.Children.Add(Panel2);
+                        break;
+                    case 3:
+                        Panel3 = new UserControlUserPanel();
+                        Panel3.Name = "UserPanel3";
+                        //3-Rajout sur la Grid Root
+                        root.Children.Add(Panel3);
+                        break;
+                    case 4:
+                        Panel4 = new UserControlUserPanel();
+                        Panel4.Name = "UserPanel4";
+                        //3-Rajout sur la Grid Root
+                        root.Children.Add(Panel4);
+                        break;
+                }
             }
             catch (Exception ex) { }
         }