public void MettreAJour(double tempsInterAffichage) { try { if (isActive) { FonctionsNatives.redimensionnerFenetre(panel2.Width, panel2.Height); } this.Invoke((MethodInvoker) delegate { //si la zone est réussi if (FonctionsNatives.victoire() == 1) { this.DialogResult = DialogResult.OK; FonctionsNatives.desactiverSon(); FonctionsNatives.libererOpenGL(); isActive = false; this.Close(); } //si la zone est échoué else if (FonctionsNatives.gameOver() == 1) { this.DialogResult = DialogResult.No; FonctionsNatives.desactiverSon(); FonctionsNatives.libererOpenGL(); isActive = false; this.Close(); } if (!pause) { FonctionsNatives.animer(tempsInterAffichage); } FonctionsNatives.dessinerOpenGL(); }); } catch (Exception) { } }