UserControlClose more readable and MainSurfaceWindow now uses the ConfirmYesOrNo event.
--- a/src/FingersDance.Control.Close/UserControlClose.xaml Tue Oct 13 10:43:39 2009 +0200
+++ b/src/FingersDance.Control.Close/UserControlClose.xaml Tue Oct 13 11:53:15 2009 +0200
@@ -5,14 +5,16 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="FingersDance.Control.Close.UserControlClose"
- Width="Auto" Height="100" MinWidth="250" xmlns:Custom="http://schemas.microsoft.com/surface/2008" BorderBrush="White" x:Name="myUC">
+ Width="Auto" Height="90" 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"
+ <TextBlock Margin="10,5,10,0" 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" />
+ <Custom:SurfaceButton x:Name="SurfaceButtonOK" TextBlock.FontSize="16" Content="Oui" Foreground="White" VerticalAlignment="Top"
+ Margin="35,55,0,0" HorizontalAlignment="Left" Width="85" ContactDown="SurfaceButtonOK_ContactDown" Click="SurfaceButtonOK_Click" Height="26" />
+ <Custom:SurfaceButton x:Name="SurfaceButtonNO" TextBlock.FontSize="16" Content="Non" Foreground="White" VerticalAlignment="Top"
+ Margin="0,55,28,0" HorizontalAlignment="Right" Width="85" ContactDown="SurfaceButtonNO_ContactDown" Click="SurfaceButtonNO_Click" Height="26" />
</Grid>
</UserControl>
\ No newline at end of file
--- a/src/FingersDance.Control.Close/UserControlClose.xaml.cs Tue Oct 13 10:43:39 2009 +0200
+++ b/src/FingersDance.Control.Close/UserControlClose.xaml.cs Tue Oct 13 11:53:15 2009 +0200
@@ -13,11 +13,17 @@
public class ConfirmEventArgs : EventArgs
{
public Boolean Confirmed;
+ public int PanelNumber = 0;
public ConfirmEventArgs(Boolean b)
{
Confirmed = b;
}
+ public ConfirmEventArgs(Boolean b, int panelNum)
+ {
+ Confirmed = b;
+ PanelNumber = panelNum;
+ }
}
public partial class UserControlClose
@@ -57,7 +63,7 @@
if (ConfirmYesOrNo != null)
{
close = true;
- ConfirmYesOrNo(this, new ConfirmEventArgs(true));
+ ConfirmYesOrNo(this, new ConfirmEventArgs(true, Id));
}
}
@@ -66,7 +72,7 @@
if (ConfirmYesOrNo != null)
{
close = true;
- ConfirmYesOrNo(this, new ConfirmEventArgs(true));
+ ConfirmYesOrNo(this, new ConfirmEventArgs(true, Id));
}
}
@@ -75,7 +81,7 @@
if (ConfirmYesOrNo != null)
{
close = false;
- ConfirmYesOrNo(this, new ConfirmEventArgs(false));
+ ConfirmYesOrNo(this, new ConfirmEventArgs(false, Id));
}
}
@@ -84,7 +90,7 @@
if (ConfirmYesOrNo != null)
{
close = false;
- ConfirmYesOrNo(this, new ConfirmEventArgs(false));
+ ConfirmYesOrNo(this, new ConfirmEventArgs(false, Id));
}
}
}
--- a/src/FingersDance/MainSurfaceWindow.xaml.cs Tue Oct 13 10:43:39 2009 +0200
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs Tue Oct 13 11:53:15 2009 +0200
@@ -392,12 +392,12 @@
}
//Actions du boutton Alert selon l'action close OK ou NON
- private void CloseAlert_EH_SurfaceButton_ContactDown(object sender, EventArgs e)
+ private void CloseAlert_EH_SurfaceButton_ContactDown(object sender, ConfirmEventArgs e)
{
Grid root = (Grid)(((UserControlClose)sender).Parent);
- if(((UserControlClose) sender).close)
+ if(e.Confirmed==true)
{
- switch(((UserControlClose)sender).Id)
+ switch(e.PanelNumber)
{
case 1:
root.Children.Remove(Panel1);