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.
authorcavaliet
Tue, 13 Oct 2009 10:43:39 +0200
changeset 140 fc7c12f9da30
parent 139 7eb5f979d086
child 141 923687896770
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.
src/FingersDance.ActionFactory/ActionGenerator.cs
src/FingersDance.Actions/FingersDance.Actions.csproj
src/FingersDance.Control.Close/FingersDance.Control.Close.csproj
src/FingersDance.Control.Close/SurfaceWindow1.xaml
src/FingersDance.Control.Close/SurfaceWindow1.xaml.cs
src/FingersDance.Control.Close/UserControlClose.xaml
src/FingersDance.Control.Close/UserControlClose.xaml.cs
src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj
src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml
src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs
src/FingersDance.Views/TimelineView.xaml.cs
src/FingersDance/MainSurfaceWindow.xaml.cs
--- a/src/FingersDance.ActionFactory/ActionGenerator.cs	Sun Oct 11 20:38:22 2009 +0200
+++ b/src/FingersDance.ActionFactory/ActionGenerator.cs	Tue Oct 13 10:43:39 2009 +0200
@@ -17,7 +17,7 @@
             actionDict.Add("ActionOpenMedia", typeof(FingersDance.Actions.ActionOpenMedia));
             actionDict.Add("ActionStopMedia", typeof(FingersDance.Actions.ActionStopMedia));
 
-            //actionDict.Add("ActionStartOrEndAnnotation", typeof(FingersDance.Actions.ActionStartOrEndAnnotation));
+            actionDict.Add("ActionStartOrEndAnnotation", typeof(FingersDance.Actions.ActionStartOrEndAnnotation));
             actionDict.Add("ActionAddAnnotation", typeof(FingersDance.Actions.ActionAddAnnotation));
         }
 
--- a/src/FingersDance.Actions/FingersDance.Actions.csproj	Sun Oct 11 20:38:22 2009 +0200
+++ b/src/FingersDance.Actions/FingersDance.Actions.csproj	Tue Oct 13 10:43:39 2009 +0200
@@ -82,6 +82,7 @@
     <Compile Include="ActionOpenMedia.cs" />
     <Compile Include="ActionPlayMedia.cs" />
     <Compile Include="ActionShowMessage.cs" />
+    <Compile Include="ActionStartOrEndAnnotation.cs" />
     <Compile Include="ActionStopMedia.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <EmbeddedResource Include="Properties\Resources.resx">
--- a/src/FingersDance.Control.Close/FingersDance.Control.Close.csproj	Sun Oct 11 20:38:22 2009 +0200
+++ b/src/FingersDance.Control.Close/FingersDance.Control.Close.csproj	Tue Oct 13 10:43:39 2009 +0200
@@ -104,9 +104,6 @@
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
       <DependentUpon>Settings.settings</DependentUpon>
     </Compile>
-    <Compile Include="SurfaceWindow1.xaml.cs">
-      <DependentUpon>SurfaceWindow1.xaml</DependentUpon>
-    </Compile>
     <AppDesigner Include="Properties\" />
   </ItemGroup>
   <ItemGroup>
@@ -121,11 +118,5 @@
   <ItemGroup>
     <Resource Include="Resources\WindowBackground.jpg" />
   </ItemGroup>
-  <ItemGroup>
-    <Page Include="SurfaceWindow1.xaml">
-      <Generator>MSBuild:Compile</Generator>
-      <SubType>Designer</SubType>
-    </Page>
-  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
--- a/src/FingersDance.Control.Close/SurfaceWindow1.xaml	Sun Oct 11 20:38:22 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<s:SurfaceWindow x:Class="FingersDance.Control.Close.SurfaceWindow1"
-    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    xmlns:s="http://schemas.microsoft.com/surface/2008"
-    Title="FingersDance.Control.Close"
-    >
-  <s:SurfaceWindow.Resources>
-    <ImageBrush x:Key="WindowBackground" Stretch="None" Opacity="0.6" ImageSource="pack://application:,,,/Resources/WindowBackground.jpg"/>
-  </s:SurfaceWindow.Resources>
-
-  <Grid Background="{StaticResource WindowBackground}" >
-
-  </Grid>
-</s:SurfaceWindow>
--- a/src/FingersDance.Control.Close/SurfaceWindow1.xaml.cs	Sun Oct 11 20:38:22 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-using System.Windows.Threading;
-using Microsoft.Surface;
-using Microsoft.Surface.Presentation;
-using Microsoft.Surface.Presentation.Controls;
-
-namespace FingersDance.Control.Close
-{
-    /// <summary>
-    /// Interaction logic for SurfaceWindow1.xaml
-    /// </summary>
-    public partial class SurfaceWindow1 : SurfaceWindow
-    {
-        /// <summary>
-        /// Default constructor.
-        /// </summary>
-        public SurfaceWindow1()
-        {
-            InitializeComponent();
-
-            // Add handlers for Application activation events
-            AddActivationHandlers();
-        }
-
-
-        /// <summary>
-        /// Occurs when the window is about to close. 
-        /// </summary>
-        /// <param name="e"></param>
-        protected override void OnClosed(EventArgs e)
-        {
-            base.OnClosed(e);
-
-            // Remove handlers for Application activation events
-            RemoveActivationHandlers();
-        }
-
-        /// <summary>
-        /// Adds handlers for Application activation events.
-        /// </summary>
-        private void AddActivationHandlers()
-        {
-            // Subscribe to surface application activation events
-            ApplicationLauncher.ApplicationActivated += OnApplicationActivated;
-            ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed;
-            ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated;
-        }
-
-        /// <summary>
-        /// Removes handlers for Application activation events.
-        /// </summary>
-        private void RemoveActivationHandlers()
-        {
-            // Unsubscribe from surface application activation events
-            ApplicationLauncher.ApplicationActivated -= OnApplicationActivated;
-            ApplicationLauncher.ApplicationPreviewed -= OnApplicationPreviewed;
-            ApplicationLauncher.ApplicationDeactivated -= OnApplicationDeactivated;
-        }
-
-        /// <summary>
-        /// This is called when application has been activated.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void OnApplicationActivated(object sender, EventArgs e)
-        {
-            //TODO: enable audio, animations here
-        }
-
-        /// <summary>
-        /// This is called when application is in preview mode.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void OnApplicationPreviewed(object sender, EventArgs e)
-        {
-            //TODO: Disable audio here if it is enabled
-
-            //TODO: optionally enable animations here
-        }
-
-        /// <summary>
-        ///  This is called when application has been deactivated.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void OnApplicationDeactivated(object sender, EventArgs e)
-        {
-            //TODO: disable audio, animations here
-        }
-    }
-}
\ No newline at end of file
--- a/src/FingersDance.Control.Close/UserControlClose.xaml	Sun Oct 11 20:38:22 2009 +0200
+++ b/src/FingersDance.Control.Close/UserControlClose.xaml	Tue Oct 13 10:43:39 2009 +0200
@@ -5,12 +5,14 @@
 	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 	mc:Ignorable="d"
 	x:Class="FingersDance.Control.Close.UserControlClose"
-	x:Name="UserControl"
-	Width="359.284" Height="210.955" xmlns:Custom="http://schemas.microsoft.com/surface/2008" BorderBrush="White">
-
-	<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" 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"/>
+	Width="Auto" Height="100" MinWidth="250" xmlns:Custom="http://schemas.microsoft.com/surface/2008" BorderBrush="White" x:Name="myUC">
+    <UserControl.Background>
+        <SolidColorBrush Color="Black" Opacity="0.8"/>
+    </UserControl.Background>
+	<Grid x:Name="LayoutRoot" >
+        <TextBlock Margin="10,5,10,43" Text="{Binding Path=Question, ElementName=myUC}" Foreground="White"
+               FontSize="18" TextWrapping="Wrap"></TextBlock>
+        <Custom:SurfaceButton Content="Oui" Margin="35,63,0,0" x:Name="SurfaceButtonOK" HorizontalAlignment="Left" Width="85" ContactDown="SurfaceButtonOK_ContactDown" Click="SurfaceButtonOK_Click" Height="30" VerticalAlignment="Top" />
+		<Custom:SurfaceButton VerticalAlignment="Top" Content="Non" Margin="0,63,28,0" x:Name="SurfaceButtonNO" ContactDown="SurfaceButtonNO_ContactDown" Click="SurfaceButtonNO_Click" Height="30" HorizontalAlignment="Right" Width="85" />
 	</Grid>
 </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Control.Close/UserControlClose.xaml.cs	Sun Oct 11 20:38:22 2009 +0200
+++ b/src/FingersDance.Control.Close/UserControlClose.xaml.cs	Tue Oct 13 10:43:39 2009 +0200
@@ -10,53 +10,81 @@
 
 namespace FingersDance.Control.Close
 {
+    public class ConfirmEventArgs : EventArgs
+    {
+        public Boolean Confirmed;
+
+        public ConfirmEventArgs(Boolean b)
+        {
+            Confirmed = b;
+        }
+    }
+
 	public partial class UserControlClose
 	{
-        public event EventHandler EH_SurfaceButtonClose_ContactDown;
+        public event EventHandler<ConfirmEventArgs> ConfirmYesOrNo; 
         public bool close;
         public int Id = 0;
 
-		public UserControlClose(int closeid)
+        public static readonly DependencyProperty QuestionProperty = DependencyProperty.Register("Question", typeof(String), typeof(UserControlClose));
+
+		public UserControlClose()
 		{
-            Id = closeid;
 			this.InitializeComponent();
 
 			// Insert code required on object creation below this point.
-		}
+        }
+
+
+        public UserControlClose(int closeid, String sentence)
+        {
+            this.InitializeComponent();
+
+            Id = closeid;
+            Question = sentence;
+        }
+
+
+        public String Question
+        {
+            get { return (String)GetValue(QuestionProperty); }
+            set { SetValue(QuestionProperty, value); }
+        }
+
 
         private void SurfaceButtonOK_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
         {
-            if (EH_SurfaceButtonClose_ContactDown != null)
+            if (ConfirmYesOrNo != null)
             {
                 close = true;
-                EH_SurfaceButtonClose_ContactDown(this, new EventArgs());
+                ConfirmYesOrNo(this, new ConfirmEventArgs(true));
+            }
+        }
+
+        private void SurfaceButtonOK_Click(object sender, RoutedEventArgs e)
+        {
+            if (ConfirmYesOrNo != null)
+            {
+                close = true;
+                ConfirmYesOrNo(this, new ConfirmEventArgs(true));
             }
         }
 
         private void SurfaceButtonNO_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
         {
-            if (EH_SurfaceButtonClose_ContactDown != null)
+            if (ConfirmYesOrNo != null)
             {
                 close = false;
-                EH_SurfaceButtonClose_ContactDown(this, new EventArgs());
+                ConfirmYesOrNo(this, new ConfirmEventArgs(false));
             }
         }
 
         private void SurfaceButtonNO_Click(object sender, RoutedEventArgs e)
         {
-            if (EH_SurfaceButtonClose_ContactDown != null)
+            if (ConfirmYesOrNo != 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());
+                ConfirmYesOrNo(this, new ConfirmEventArgs(false));
             }
         }
 	}
--- a/src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj	Sun Oct 11 20:38:22 2009 +0200
+++ b/src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj	Tue Oct 13 10:43:39 2009 +0200
@@ -73,7 +73,6 @@
     <Reference Include="WindowsBase" />
     <Reference Include="PresentationCore" />
     <Reference Include="PresentationFramework" />
-    <Reference Include="Microsoft.Surface" />
     <Reference Include="Microsoft.Surface.Presentation" />
     <Reference Include="Microsoft.Surface.Presentation.Generic" />
     <Resource Include="FingersDance.Control.TimeLine.Ressources.xaml">
@@ -125,6 +124,10 @@
     <Resource Include="Resources\WindowBackground.jpg" />
   </ItemGroup>
   <ItemGroup>
+    <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.Data\FingersDance.Data.csproj">
       <Project>{EAF384DB-2AE4-4132-839D-60F9DAFDEAD8}</Project>
       <Name>FingersDance.Data</Name>
@@ -138,5 +141,8 @@
       <Name>FingersDance.Views</Name>
     </ProjectReference>
   </ItemGroup>
+  <ItemGroup>
+    <WCFMetadata Include="Service References\" />
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml	Sun Oct 11 20:38:22 2009 +0200
+++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml	Tue Oct 13 10:43:39 2009 +0200
@@ -5,8 +5,9 @@
 	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 	mc:Ignorable="d"
     xmlns:vw="clr-namespace:FingersDance.Views;assembly=FingersDance.Views"
+    xmlns:popup="clr-namespace:FingersDance.Control.Close;assembly=FingersDance.Control.Close"
 	xmlns:Custom="http://schemas.microsoft.com/surface/2008" xmlns:Microsoft_Surface_Presentation_Generic="clr-namespace:Microsoft.Surface.Presentation.Generic;assembly=Microsoft.Surface.Presentation.Generic"
-	x:Class="FingersDance.Control.TimeLine.UserControlTimeLine"
+    x:Class="FingersDance.Control.TimeLine.UserControlTimeLine"
 	x:Name="UserControl"
 	d:DesignWidth="383" Background="{x:Null}" d:DesignHeight="33">
 
@@ -781,5 +782,6 @@
 		<Custom:SurfaceSlider  Height="Auto" x:Name="slider" Value="0.5" Width="Auto" 
                                Thumb.DragStarted="sliderPosition_DragStarted" Thumb.DragCompleted="sliderPosition_DragCompleted" ContactTapGesture="slider_ContactTapGesture" Background="#19FFFFFF" Style="{DynamicResource FingersDance.Control.Slider}" />
         <vw:TimelineView x:Name="tv" Margin="0,15,0,0" Background="{x:Null}"/>
+        <popup:UserControlClose x:Name="confirmCancelPopup" Question="Êtes-vous de sûr de vouloir effacer cette annotation ?" Visibility="Hidden" ConfirmYesOrNo="confirmCancelPopup_ConfirmYesOrNo" />
     </Grid>
 </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Sun Oct 11 20:38:22 2009 +0200
+++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Tue Oct 13 10:43:39 2009 +0200
@@ -10,13 +10,14 @@
 using System.Windows.Media.Animation;
 using System.Windows.Navigation;
 using System.Windows.Controls.Primitives;
+using Microsoft.Surface.Presentation;
 using Microsoft.Surface.Presentation.Controls;
-using Microsoft.Surface.Presentation;
 using System.Windows.Threading;
 
 using FingersDance.Data;
 using FingersDance.ViewModels;
 using FingersDance.Views;
+using FingersDance.Control.Close;
 
 namespace FingersDance.Control.TimeLine
 {
@@ -28,7 +29,7 @@
         private bool isDragging = false;
         private bool finishedDragging = false;
         #endregion
-
+        
         public event EventHandler DragStarted;
         public event EventHandler DragCompleted;
         public event EventHandler TimerTick;
@@ -41,6 +42,8 @@
         private Boolean AnnotWaiting = false;
         private float AnnotTcBegin;
 
+        private AnnotationViewModel canceledAnnotationVM;
+
         #region Properties
 
         public SurfaceSlider Slider
@@ -98,7 +101,7 @@
 		public UserControlTimeLine()
 		{
 			this.InitializeComponent();
-
+            
 			// Insert code required on object creation below this point.
             
 		}
@@ -361,7 +364,7 @@
                     DataContext = findSource.DataContext
                 }
             };
-
+            
             // We apply the current scale to the dragged annotation
             ((TimelineAnnotationView)cursorVisual.Content).RenderTransform = this.RenderTransform;
 
@@ -401,28 +404,42 @@
 
         private void onDragCanceled(Object sender, SurfaceDragDropEventArgs e)
         {
-            Console.WriteLine("onDragCanceled = " + sender + ", ((ContentControl)e.Cursor.Visual).Content = " + ((ContentControl)e.Cursor.Visual).Content);
-            // e.Cursor.Visual is the ContentControl, so its Content is the dragged TimelineAnnotationView
-            AnnotationViewModel annotationDataVM = (AnnotationViewModel)((TimelineAnnotationView)((ContentControl)e.Cursor.Visual).Content).DataContext;
+            //Console.WriteLine("onDragCanceled = " + sender + ", ((ContentControl)e.Cursor.Visual).Content = " + ((ContentControl)e.Cursor.Visual).Content);
             // We check if the annotation is well one of the current annotations
             if (CuttingVM != null)
             {
+                // e.Cursor.Visual is the ContentControl, so its Content is the dragged TimelineAnnotationView
+                canceledAnnotationVM = (AnnotationViewModel)((TimelineAnnotationView)((ContentControl)e.Cursor.Visual).Content).DataContext;
+                confirmCancelPopup.Visibility = Visibility.Visible;
+            }
+        }
+
+        private void confirmCancelPopup_ConfirmYesOrNo(object sender, ConfirmEventArgs e)
+        {
+            //Console.WriteLine("Confirm = " + e.Confirmed);
+            // We check if the annotation is well one of the current annotations
+            if (CuttingVM != null && canceledAnnotationVM != null && e.Confirmed == true)
+            {
                 foreach (Annotation a in AnnotList)
                 {
-                    //Console.WriteLine("a.TcBegin = " + a.TcBegin + ", avm.TcBegin = " + avm.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur));
-                    // Check begin TC
-                    if (a.TcBegin == annotationDataVM.TcBegin && a.Dur == annotationDataVM.Dur && a.GestureType==annotationDataVM.GestureType)
+                    // Check begin TcBegin, duration and gesture type
+                    if (a.TcBegin == canceledAnnotationVM.TcBegin && a.Dur == canceledAnnotationVM.Dur && a.GestureType == canceledAnnotationVM.GestureType)
                     {
-                        // We found the good annotation so we can delete it
+                        // We found the good annotation so we can remove it
                         AnnotList.Remove(a);
                         // We redisplay the timeline
                         CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth);
                         tv.DataContext = null;
                         tv.DataContext = CuttingVM;
+                        // We close the popup and return as soon as we removed the annotation to avoid an error on AnnotList, which is just modified
+                        confirmCancelPopup.Visibility = Visibility.Hidden;
+                        canceledAnnotationVM = null;
                         return;
                     }
                 }
             }
+            confirmCancelPopup.Visibility = Visibility.Hidden;
+            canceledAnnotationVM = null;
         }
 
 
--- a/src/FingersDance.Views/TimelineView.xaml.cs	Sun Oct 11 20:38:22 2009 +0200
+++ b/src/FingersDance.Views/TimelineView.xaml.cs	Tue Oct 13 10:43:39 2009 +0200
@@ -23,8 +23,6 @@
     public partial class TimelineView : UserControl
     {
 
-        private Boolean hasDragCanceledHandler = false;
-
         public TimelineView()
         {
             InitializeComponent();
--- a/src/FingersDance/MainSurfaceWindow.xaml.cs	Sun Oct 11 20:38:22 2009 +0200
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs	Tue Oct 13 10:43:39 2009 +0200
@@ -271,10 +271,10 @@
                     {
                         if (Panel1 != null && Grid1.Children.Count == 2)
                         {
-                            UserControlClose UCclose = new UserControlClose(1);
+                            UserControlClose UCclose = new UserControlClose(1, "Êtes-vous sûr de vouloir quitter ?");
                             UCclose.Name = "CloseAlert1";
                             Grid1.Children.Add(UCclose);
-                            UCclose.EH_SurfaceButtonClose_ContactDown += new EventHandler(CloseAlert_EH_SurfaceButton_ContactDown);
+                            UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown);
                         }
                     }
                     break;
@@ -294,10 +294,10 @@
                     {
                         if (Panel2 != null && Grid2.Children.Count == 2)
                         {
-                            UserControlClose UCclose = new UserControlClose(2);
+                            UserControlClose UCclose = new UserControlClose(2, "Êtes-vous sûr de vouloir quitter ?");
                             UCclose.Name = "CloseAlert2";
                             Grid2.Children.Add(UCclose);
-                            UCclose.EH_SurfaceButtonClose_ContactDown += new EventHandler(CloseAlert_EH_SurfaceButton_ContactDown);
+                            UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown);
                         }
                     }
                     break;
@@ -317,10 +317,10 @@
                     {
                         if (Panel3 != null && Grid3.Children.Count == 2)
                         {
-                            UserControlClose UCclose = new UserControlClose(3);
+                            UserControlClose UCclose = new UserControlClose(3, "Êtes-vous sûr de vouloir quitter ?");
                             UCclose.Name = "CloseAlert3";
                             Grid3.Children.Add(UCclose);
-                            UCclose.EH_SurfaceButtonClose_ContactDown += new EventHandler(CloseAlert_EH_SurfaceButton_ContactDown);
+                            UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown);
                         }
                     }
                     break;
@@ -340,10 +340,10 @@
                     {
                         if (Panel4 != null && Grid4.Children.Count == 2)
                         {
-                            UserControlClose UCclose = new UserControlClose(4);
+                            UserControlClose UCclose = new UserControlClose(4, "Êtes-vous sûr de vouloir quitter ?");
                             UCclose.Name = "CloseAlert4";
                             Grid4.Children.Add(UCclose);
-                            UCclose.EH_SurfaceButtonClose_ContactDown += new EventHandler(CloseAlert_EH_SurfaceButton_ContactDown);
+                            UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown);
                         }
                     }
                     break;