private void Confirmer_tresor_Click(object sender, RoutedEventArgs e) { double value, value0 = 0; if (Tresor_Annee.Text == "" || !double.TryParse(Tresor_Annee.Text, out value)) { NotAccepted.Visibility = Visibility.Visible; DoubleAnimation a = new DoubleAnimation(); a.From = 1.0; a.To = 0.0; a.Duration = new Duration(TimeSpan.FromSeconds(5)); NotAccepted.BeginAnimation(OpacityProperty, a); } else { double.TryParse(Tresor_Annee.Text, out value0); double value1 = value0 + responsable.tresor; responsable.tresor = value1; responsable.nouveau_tresor(value1); Accepted.Visibility = Visibility.Visible; DoubleAnimation a = new DoubleAnimation(); a.From = 1.0; a.To = 0.0; a.Duration = new Duration(TimeSpan.FromSeconds(5)); Accepted.BeginAnimation(OpacityProperty, a); Grid_Principale.Visibility = Visibility.Visible; Grid_Principale.IsEnabled = true; Ajouter_Montant_Tresor.Visibility = Visibility.Hidden; Ajouter_Montant_Tresor.IsEnabled = false; } }