[C#][WPF] Problème de clic
Bonjour à tous,
Je débute en WPF et notemment en XAML et C#.
Je suis en train d'écrire une application disposant de plusieurs boutons (jusque là rien d'anormal).
Lorsque j'exécute le code. Je dois cliquer un fois sur n'importe quel bouton pour que ça s'exécute. (pas de prob.) par contre deux fois sur le second, trois sur le troisième, etc.
Je vois pas 36 solutions, soit je code avec mes pieds
soit mon Visual C# 2008 Express Edition est vérolé.
Pour la partie pédestre :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
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.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace A_voir
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
DispatcherTimer timer = new DispatcherTimer();
DispatcherTimer close = new DispatcherTimer();
public Window1()
{
InitializeComponent();
}
private void Button_Close(object sender, RoutedEventArgs e)
{
Bouttons.Opacity = 1;
close.Tick += new EventHandler(close_tick);
close.Interval = new TimeSpan(0, 0, 0, 0, 5);
close.Start();
}
private void Registre_click(object sender, RoutedEventArgs e)
{
Bouttons.Opacity = 1;
timer.Tick += new EventHandler(timer_tick);
timer.Interval = new TimeSpan(0, 0, 0, 0, 5);
timer.Start();
}
private void timer_tick(object sender, EventArgs e)
{
Bouttons.Opacity -= 0.01;
if (Bouttons.Opacity == 0)
{
timer.Stop();
}
}
private void close_tick(object sende, EventArgs e)
{
Bouttons.Opacity -= 0.01;
fermer.Opacity -= 0.01;
if (Bouttons.Opacity == 0)
{
this.Close();
}
}
private void New_click(object sender, RoutedEventArgs e)
{
Bouttons.Opacity = 1;
timer.Tick += new EventHandler(timer_tick);
timer.Interval = new TimeSpan(0, 0, 0, 0, 5);
timer.Start();
}
private void delete_click(object sender, RoutedEventArgs e)
{
Bouttons.Opacity = 1;
fermer.Opacity = 1;
timer.Tick += new EventHandler(timer_tick);
timer.Interval = new TimeSpan(0, 0, 0, 0, 5);
timer.Start();
}
}
} |
Qu'en pensez vous ?
Bug connu ?
Merci d'avance à toute l'aide que vous pourrez m'apporter.
Idem sur toutes mes applications