Close Control
authorsarias
Mon, 05 Oct 2009 18:29:32 +0200
changeset 131 9331c3dea175
parent 130 192da585bee5
child 132 bc7c039b4bff
Close Control
src/FingersDance.Control.Close/UserControlClose.xaml
src/FingersDance.Control.Close/UserControlClose.xaml.cs
src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs
src/FingersDance/FingersDance.csproj
src/FingersDance/MainSurfaceWindow.xaml.cs
src/FingersDance/Resources/videos.xml
--- a/src/FingersDance.Control.Close/UserControlClose.xaml	Mon Oct 05 18:23:10 2009 +0200
+++ b/src/FingersDance.Control.Close/UserControlClose.xaml	Mon Oct 05 18:29:32 2009 +0200
@@ -10,7 +10,7 @@
 
 	<Grid x:Name="LayoutRoot" Background="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}">
 		<Label Margin="88.06,56.717,76.029,0" VerticalAlignment="Top" Content="Estes-vous sure de vouloir quitter ?" Height="42.363" x:Name="LabelAlert" Foreground="White"/>
-		<Custom:SurfaceButton VerticalAlignment="Bottom" Content="Oui" Margin="81.604,0,0,27.224" x:Name="SurfaceButtonOK" HorizontalAlignment="Left" Width="85.754"/>
-		<Custom:SurfaceButton HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Non" Margin="0,0,76.029,27.224" Width="85.754" x:Name="SurfaceButtonNO"/>
+		<Custom:SurfaceButton VerticalAlignment="Bottom" Content="Oui" Margin="81.604,0,0,27.224" x:Name="SurfaceButtonOK" HorizontalAlignment="Left" Width="85.754" ContactDown="SurfaceButtonOK_ContactDown" Click="SurfaceButtonOK_Click"/>
+		<Custom:SurfaceButton HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Non" Margin="0,0,76.029,27.224" Width="85.754" x:Name="SurfaceButtonNO" ContactDown="SurfaceButtonNO_ContactDown" Click="SurfaceButtonNO_Click"/>
 	</Grid>
 </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Control.Close/UserControlClose.xaml.cs	Mon Oct 05 18:23:10 2009 +0200
+++ b/src/FingersDance.Control.Close/UserControlClose.xaml.cs	Mon Oct 05 18:29:32 2009 +0200
@@ -12,11 +12,52 @@
 {
 	public partial class UserControlClose
 	{
-		public UserControlClose()
+        public event EventHandler EH_SurfaceButtonClose_ContactDown;
+        public bool close;
+        public int Id = 0;
+
+		public UserControlClose(int closeid)
 		{
+            Id = closeid;
 			this.InitializeComponent();
 
 			// Insert code required on object creation below this point.
 		}
+
+        private void SurfaceButtonOK_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
+        {
+            if (EH_SurfaceButtonClose_ContactDown != null)
+            {
+                close = true;
+                EH_SurfaceButtonClose_ContactDown(this, new EventArgs());
+            }
+        }
+
+        private void SurfaceButtonNO_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
+        {
+            if (EH_SurfaceButtonClose_ContactDown != null)
+            {
+                close = false;
+                EH_SurfaceButtonClose_ContactDown(this, new EventArgs());
+            }
+        }
+
+        private void SurfaceButtonNO_Click(object sender, RoutedEventArgs e)
+        {
+            if (EH_SurfaceButtonClose_ContactDown != null)
+            {
+                close = false;
+                EH_SurfaceButtonClose_ContactDown(this, new EventArgs());
+            }
+        }
+
+        private void SurfaceButtonOK_Click(object sender, RoutedEventArgs e)
+        {
+            if (EH_SurfaceButtonClose_ContactDown != null)
+            {
+                close = true;
+                EH_SurfaceButtonClose_ContactDown(this, new EventArgs());
+            }
+        }
 	}
 }
\ No newline at end of file
--- a/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs	Mon Oct 05 18:23:10 2009 +0200
+++ b/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs	Mon Oct 05 18:29:32 2009 +0200
@@ -12,6 +12,8 @@
 {
 	public partial class UserControlUserPanel
 	{
+        public int id = 0;
+
 		public UserControlUserPanel()
 		{
 			this.InitializeComponent();
--- a/src/FingersDance/FingersDance.csproj	Mon Oct 05 18:23:10 2009 +0200
+++ b/src/FingersDance/FingersDance.csproj	Mon Oct 05 18:29:32 2009 +0200
@@ -134,8 +134,12 @@
     <Content Include="Resources\Lake.wmv">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
-    <Resource Include="Resources\oneflat.png" />
-    <Content Include="Resources\oneflat.wmv" />
+    <Resource Include="Resources\oneflat.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Resource>
+    <Content Include="Resources\oneflat.wmv">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
     <Content Include="Resources\videos.xml">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
@@ -155,6 +159,10 @@
       <Project>{C7B905EA-0678-4DA0-8EF8-7F9CBD22818E}</Project>
       <Name>FingersDance.ActionFactory</Name>
     </ProjectReference>
+    <ProjectReference Include="..\FingersDance.Control.Close\FingersDance.Control.Close.csproj">
+      <Project>{D579FDB5-D412-4797-A0FF-C5873AE08BB8}</Project>
+      <Name>FingersDance.Control.Close</Name>
+    </ProjectReference>
     <ProjectReference Include="..\FingersDance.Control.Menu\FingersDance.Control.Menu.csproj">
       <Project>{6960F7ED-3D82-4BCE-AB88-D31D6C72F2B6}</Project>
       <Name>FingersDance.Control.Menu</Name>
--- a/src/FingersDance/MainSurfaceWindow.xaml.cs	Mon Oct 05 18:23:10 2009 +0200
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs	Mon Oct 05 18:29:32 2009 +0200
@@ -17,6 +17,7 @@
 
 using FingersDance.Control.UserPanel;
 using FingersDance.Control.Screen;
+using FingersDance.Control.Close;
 
 
 namespace FingersDance
@@ -242,6 +243,13 @@
 
                         Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
                     }
+                    else //Affichage du message de confirmation
+                    {
+                        UserControlClose UCclose = new UserControlClose(1);
+                        UCclose.Name = "CloseAlert1";
+                        Grid1.Children.Add(UCclose);
+                        UCclose.EH_SurfaceButtonClose_ContactDown += new EventHandler(CloseAlert_EH_SurfaceButton_ContactDown);
+                    }
                     break;
                 case 2:
                     if (Panel2 == null)
@@ -255,6 +263,13 @@
 
                         Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
                     }
+                    else //Affichage du message de confirmation
+                    {
+                        UserControlClose UCclose = new UserControlClose(2);
+                        UCclose.Name = "CloseAlert2";
+                        Grid2.Children.Add(UCclose);
+                        UCclose.EH_SurfaceButtonClose_ContactDown += new EventHandler(CloseAlert_EH_SurfaceButton_ContactDown);
+                    }
                     break;
                 case 3:
                     if (Panel3 == null)
@@ -268,6 +283,13 @@
 
                         Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
                     }
+                    else //Affichage du message de confirmation
+                    {
+                        UserControlClose UCclose = new UserControlClose(3);
+                        UCclose.Name = "CloseAlert3";
+                        Grid3.Children.Add(UCclose);
+                        UCclose.EH_SurfaceButtonClose_ContactDown += new EventHandler(CloseAlert_EH_SurfaceButton_ContactDown);
+                    }
                     break;
                 case 4:
                     if (Panel4 == null)
@@ -281,6 +303,13 @@
 
                         Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
                     }
+                    else //Affichage du message de confirmation
+                    {
+                        UserControlClose UCclose = new UserControlClose(4);
+                        UCclose.Name = "CloseAlert4";
+                        Grid4.Children.Add(UCclose);
+                        UCclose.EH_SurfaceButtonClose_ContactDown += new EventHandler(CloseAlert_EH_SurfaceButton_ContactDown);
+                    }
                     break;
             }
                         
@@ -326,7 +355,30 @@
             catch (Exception ex) { }
         }
 
-
+        //Actions du boutton Alert selon l'action close OK ou NON
+        private void CloseAlert_EH_SurfaceButton_ContactDown(object sender, EventArgs e)
+        {
+            Grid root = (Grid)(((UserControlClose)sender).Parent);
+            if(((UserControlClose) sender).close)
+            {
+                switch(((UserControlClose)sender).Id)
+                {
+                    case 1:
+                        root.Children.Remove(Panel1);
+                        break;
+                    case 2:
+                        root.Children.Remove(Panel2);
+                        break;
+                    case 3:
+                        root.Children.Remove(Panel3);
+                        break;
+                    case 4:
+                        root.Children.Remove(Panel4);
+                        break;
+                }
+            }
+            root.Children.Remove(((UserControlClose)sender));
+        }
 
     }
 }
\ No newline at end of file
--- a/src/FingersDance/Resources/videos.xml	Mon Oct 05 18:23:10 2009 +0200
+++ b/src/FingersDance/Resources/videos.xml	Mon Oct 05 18:29:32 2009 +0200
@@ -2,17 +2,17 @@
 <ArrayOfListVideoItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <ListVideoItem>
     <Name>Butterfly</Name>
-    <Path>C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\Butterfly.wmv</Path>
-    <Preview>C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\Butterfly.jpg</Preview>
+    <Path>C:\Users\santiago\Desktop\MercurialSurfaceFingerDance\src\FingersDance\bin\Debug\Resources\Butterfly.wmv</Path>
+    <Preview>C:\Users\santiago\Desktop\MercurialSurfaceFingerDance\src\FingersDance\bin\Debug\Resources\Butterfly.jpg</Preview>
   </ListVideoItem>
   <ListVideoItem>
     <Name>Lake</Name>
-    <Path>C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\Lake.wmv</Path>
-    <Preview>C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\Lake.jpg</Preview>
+    <Path>C:\Users\santiago\Desktop\MercurialSurfaceFingerDance\src\FingersDance\bin\Debug\Resources\Lake.wmv</Path>
+    <Preview>C:\Users\santiago\Desktop\MercurialSurfaceFingerDance\src\FingersDance\bin\Debug\Resources\Lake.jpg</Preview>
   </ListVideoItem>
   <ListVideoItem>
     <Name>One Flat Thing</Name>
-    <Path>C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\oneflat.wmv</Path>
-    <Preview>C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\oneflat.png</Preview>
+    <Path>C:\Users\santiago\Desktop\MercurialSurfaceFingerDance\src\FingersDance\bin\Debug\Resources\oneflat.wmv</Path>
+    <Preview>C:\Users\santiago\Desktop\MercurialSurfaceFingerDance\src\FingersDance\bin\Debug\Resources\oneflat.png</Preview>
   </ListVideoItem>
 </ArrayOfListVideoItem>
\ No newline at end of file