Se connecter avec
S'enregistrer | Connectez-vous

[C#][WPF] Problème de clic

Dernière réponse : dans Programmation

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 :cry: 
soit mon Visual C# 2008 Express Edition est vérolé.
Pour la partie pédestre :
  1. using System.Text;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using System.Windows.Data;
  5. using System.Windows.Documents;
  6. using System.Windows.Input;
  7. using System.Windows.Media;
  8. using System.Windows.Media.Imaging;
  9. using System.Windows.Navigation;
  10. using System.Windows.Shapes;
  11. using System.Windows.Threading;
  12.  
  13.  
  14. namespace A_voir
  15. {
  16. /// <summary>
  17. /// Interaction logic for Window1.xaml
  18. /// </summary>
  19. public partial class Window1 : Window
  20. {
  21. DispatcherTimer timer = new DispatcherTimer();
  22. DispatcherTimer close = new DispatcherTimer();
  23.  
  24. public Window1()
  25. {
  26. InitializeComponent();
  27. }
  28.  
  29. private void Button_Close(object sender, RoutedEventArgs e)
  30. {
  31. Bouttons.Opacity = 1;
  32. close.Tick += new EventHandler(close_tick);
  33. close.Interval = new TimeSpan(0, 0, 0, 0, 5);
  34. close.Start();
  35. }
  36.  
  37. private void Registre_click(object sender, RoutedEventArgs e)
  38. {
  39. Bouttons.Opacity = 1;
  40. timer.Tick += new EventHandler(timer_tick);
  41. timer.Interval = new TimeSpan(0, 0, 0, 0, 5);
  42.  
  43. timer.Start();
  44. }
  45. private void timer_tick(object sender, EventArgs e)
  46. {
  47. Bouttons.Opacity -= 0.01;
  48.  
  49. if (Bouttons.Opacity == 0)
  50. {
  51. timer.Stop();
  52. }
  53. }
  54.  
  55. private void close_tick(object sende, EventArgs e)
  56. {
  57. Bouttons.Opacity -= 0.01;
  58. fermer.Opacity -= 0.01;
  59.  
  60. if (Bouttons.Opacity == 0)
  61. {
  62. this.Close();
  63. }
  64.  
  65.  
  66.  
  67. }
  68.  
  69. private void New_click(object sender, RoutedEventArgs e)
  70. {
  71. Bouttons.Opacity = 1;
  72. timer.Tick += new EventHandler(timer_tick);
  73. timer.Interval = new TimeSpan(0, 0, 0, 0, 5);
  74.  
  75. timer.Start();
  76. }
  77.  
  78. private void delete_click(object sender, RoutedEventArgs e)
  79. {
  80. Bouttons.Opacity = 1;
  81. fermer.Opacity = 1;
  82. timer.Tick += new EventHandler(timer_tick);
  83. timer.Interval = new TimeSpan(0, 0, 0, 0, 5);
  84.  
  85. timer.Start();
  86. }
  87. }
  88. }


Qu'en pensez vous ?
Bug connu ?
Merci d'avance à toute l'aide que vous pourrez m'apporter.

Autres pages sur : wpf probleme clic

Lassé par la pub ? Créez un compte

Trouvé !

Après trois mois ! Ben en fait, c'est tout simplement le compilateur du Visual C# 2008 Express Edition en FRANCAIS qui me générait cette erreur. Réinstallation du même logiciel en ANGLAIS et tout rentre dans l'ordre !
Lassé par la pub ? Créez un compte
Tom's guide dans le monde