private void cmdEnvoyer_Click(object sender, RoutedEventArgs ev) { bool b = true; switch (action) { case CONVOCATION_PARENT: if (convocationParent.lblStatut.Content.ToString() != GestionNotificationBL.INFORMATIONS_VALIDEES) { b = false; } break; case CONVOCATION_PERSONNEL: if (convocationPersonnel.lblStatut.Content.ToString() != GestionNotificationBL.INFORMATIONS_VALIDEES) { b = false; } break; case REUNION: if (reunion.lblStatut.Content.ToString() != GestionNotificationBL.INFORMATIONS_VALIDEES) { b = false; } break; case REUNION_ELEVE: if (reunionEleve.lblStatut.Content.ToString() != GestionNotificationBL.INFORMATIONS_VALIDEES) { b = false; } break; case ENVOI_RESULTAT: if (envoiResultat.lblStatut.Content.ToString() != GestionNotificationBL.INFORMATIONS_VALIDEES) { b = false; } break; default: break; } if (!Tools.HasConnection()) { MessageBox.Show("Vous avez besoin de connexion internet pour envoyer les messages"); b = false; } else if (b == false) { MessageBox.Show("Veuillez après avoir renseigné les informations cliquer sur VALIDER avant de cliquer sur ENVOYER", "School brain:Information", MessageBoxButton.OK, MessageBoxImage.Information); } else { BackgroundWorker bwr = new BackgroundWorker(); ProgressDialogResult result = ProgressDialog.Execute(this, "Loading data...", (bw, we) => { var thread = new Thread(() => { actionToExcecuteOnClick(); }); thread.Start(); while (thread.IsAlive) { Console.WriteLine("running"); } Console.WriteLine("end"); }); rapportUC = new RapportNotificationUC(nb, nbreussi, echecs); panelForm.Children.Clear(); panelForm.Children.Add(rapportUC); } }