src/FingersDance/MainSurfaceWindow.xaml.cs
changeset 224 874de6d84a2e
parent 223 90d2be5c3d39
child 225 b60e13ed75c8
--- a/src/FingersDance/MainSurfaceWindow.xaml.cs	Mon Nov 23 18:36:27 2009 +0100
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs	Tue Nov 24 07:50:17 2009 +0100
@@ -219,8 +219,12 @@
                     try
                     {
                         if (Panel1 != null)
+                        {
                             Panel1.PlayerPause();
+                            Panel1.PanelVisibility(Visibility.Hidden);
+                        }
                         Grid1.Children[1].Visibility = Visibility.Hidden;
+
                     }
                     catch (Exception) { }
                 }
@@ -228,7 +232,11 @@
                 {
                     try
                     { 
-                        Grid1.Children[1].Visibility = Visibility.Visible; 
+                        Grid1.Children[1].Visibility = Visibility.Visible;
+                        if (Panel1 != null)
+                        {
+                            Panel1.PanelVisibility(Visibility.Visible);
+                        }
                     }
                     catch (Exception) { }
                 }
@@ -238,7 +246,10 @@
                     try
                     {
                         if (Panel2 != null)
+                        {
                             Panel2.PlayerPause();
+                            Panel2.PanelVisibility(Visibility.Hidden);
+                        }
                         Grid2.Children[1].Visibility = Visibility.Hidden; 
                     }
                     catch (Exception) { }
@@ -247,7 +258,11 @@
                 {
                     try
                     {
-                        Grid2.Children[1].Visibility = Visibility.Visible; 
+                        Grid2.Children[1].Visibility = Visibility.Visible;
+                        if (Panel2 != null)
+                        {
+                            Panel2.PanelVisibility(Visibility.Visible);
+                        }
                     }
                     catch (Exception) { }
                 }
@@ -257,7 +272,10 @@
                     try
                     {
                         if (Panel3 != null)
+                        {
                             Panel3.PlayerPause();
+                            Panel3.PanelVisibility(Visibility.Hidden);
+                        }
                         Grid3.Children[1].Visibility = Visibility.Hidden;
                     }
                     catch (Exception) { }
@@ -266,7 +284,11 @@
                 {
                     try
                     {
-                        Grid3.Children[1].Visibility = Visibility.Visible; 
+                        Grid3.Children[1].Visibility = Visibility.Visible;
+                        if (Panel3 != null)
+                        {
+                            Panel3.PanelVisibility(Visibility.Visible);
+                        }
                     }
                     catch (Exception) { }
                 }
@@ -276,7 +298,10 @@
                     try
                     {
                         if (Panel4 != null)
+                        {
                             Panel4.PlayerPause();
+                            Panel4.PanelVisibility(Visibility.Hidden);
+                        }
                         Grid4.Children[1].Visibility = Visibility.Hidden;
                     }
                     catch (Exception) { }
@@ -286,6 +311,10 @@
                     try
                     { 
                         Grid4.Children[1].Visibility = Visibility.Visible;
+                        if (Panel4 != null)
+                        {
+                            Panel4.PanelVisibility(Visibility.Visible);
+                        }
                     }
                     catch (Exception) { }
                 }
@@ -293,6 +322,28 @@
             catch (Exception) { }
         }
 
+        //SAR
+        private void ScatterViewItemPivot_ContactLeave(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;
+                ((ScatterViewItem)sender).Center = new Point(e.GetPosition(mainSurfaceWindow).X,e.GetPosition(mainSurfaceWindow).Y);
+            }
+            catch (Exception) { }
+        }
+
         private void UserControlPivot_EH_SurfaceButtonPlayer_ContactDown(object sender, EventArgs e)
         {
             //  Traitement du contact down sur le pivot (Création d'un screen ou suppression d'un panel
@@ -502,21 +553,25 @@
                     case 1:
                         UserControlPivot.ApplyColor(1, 0);
                         root.Children.Remove(Panel1);
+                        Panel1.PanelClose();
                         Panel1 = null;
                         break;
                     case 2:
                         UserControlPivot.ApplyColor(2, 0);
                         root.Children.Remove(Panel2);
+                        Panel2.PanelClose();
                         Panel2 = null;
                         break;
                     case 3:
                         UserControlPivot.ApplyColor(3, 0);
                         root.Children.Remove(Panel3);
+                        Panel3.PanelClose();
                         Panel3 = null;
                         break;
                     case 4:
                         UserControlPivot.ApplyColor(4, 0);
                         root.Children.Remove(Panel4);
+                        Panel4.PanelClose();
                         Panel4 = null;
                         break;
                 }
@@ -651,5 +706,7 @@
                 CreditsScroll4.Visibility = (CreditsScroll4.Visibility == Visibility.Hidden) ? Visibility.Visible : Visibility.Hidden;
             }
         }
+
+        
     }
 }
\ No newline at end of file