/***************************************************/ /*Bouton Aller a la prochaine question*/ private void Next_Click(object sender, RoutedEventArgs e) { Animations.AddSound(1); //Ajout de son Ok.Visibility = Visibility.Hidden; //bouton valider indisponible Next.Visibility = Visibility.Hidden; //bouton Aller a la prochaine question indisponible /*Si la fin du fichier est atieinte et le nombre de question deja faites < 8 alors on revient au debut du fichier*/ if (i == totalQuestion) { i = 1; } /***********************************/ /*Sinon on continu*/ else { i++; } /*****************/ /*Reccuperation de la question et de ces choix*/ path = "//Chapitre" + numChapitre + "/Probleme" + i; GetQuestionFromFile(path); /********************************************/ /*Affichage du score actuel ainsi que le nombre de la question actuel*/ ScoreTB.Inlines.Clear(); ScoreTB.Inlines.Add(new Run("السؤال : " + nbQuest + " /8")); /*******************************************/ for (int nb = 1; nb <= 3; nb++) { /*Reinitialisation des boutons radios*/ RadioButton r = this.FindName("r" + nb) as RadioButton; r.IsEnabled = true; r.IsChecked = false; /**************************************/ /*Reinitialisation des images commentaires*/ Image comment = this.FindName("comment" + nb) as Image; comment.Source = null; /********************************************/ } /*Changement de couleurs du background est des conteneurs des la question et de ces choix*/ QcmGrid.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom(colorBrushesBackground[j])); QuestionRtb.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom(colorBrushesRTB[k])); Choix1Rtb.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom(colorBrushesRTB[k])); Choix2Rtb.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom(colorBrushesRTB[k])); Choix3Rtb.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom(colorBrushesRTB[k])); image.Source = Animations.GetImage(@"Images/image" + k + ".png"); /*************************************************************************************/ k++; //parcours de la premiere liste de couleurs. j++; //parcours de la deuxieme liste de couleurs. if (k == colorBrushesRTB.Count) { k = 0; } //reinialiser si fin de liste if (j == colorBrushesBackground.Count) { j = 0; } //reinialiser si fin de liste }
Ellipse ellipse; //Forme geometrique:sera utilisé pour afficher le numero de page. /************************************************************/ /*Methodes*/ /*Une methode que sert à recupperer la description à partir du fichier, * ainsi que la capture d'interface correspondante * et de les afficher*/ private void GeneratePage(int pageNumber) { /*Recuperation de la description*/ description = monFichier.SelectSingleNode("//Help/Page" + pageNumber).InnerText; /*********************************/ /*Affichage de la description*/ DescriptionParagraph.Inlines.Clear(); DescriptionParagraph.Inlines.Add(description); /*****************************************/ /*Affichage de la capture correspondante*/ DescriptionImage.Source = Animations.GetImage(@"Images/descriptionImage" + pageNumber + ".jpg"); /***************************************/ }
private void setButtonTestFinal() { Exercice exercice = new Exercice(); int acces = exercice.ScoreTotal(); /* condition d'acces au test final */ if (acces <= 60) { this.TestFinal.IsEnabled = false; } else { this.TestFinal.IsEnabled = true; } /* conditions de positionnement des etoiles selon le score realisé * acces etant le score global de ts les chapitres * */ if (acces >= 0 && acces <= 10) { StarsText.Text = "لإجتياز الإمتحان النهائي عليك الحصول على كل النجمات الذهبية و ذلك بحل التمارين"; this.star1.Source = Animations.GetImage(@"Images/gstar.png"); this.star2.Source = Animations.GetImage(@"Images/gstar.png"); this.star3.Source = Animations.GetImage(@"Images/gstar.png"); this.star4.Source = Animations.GetImage(@"Images/gstar.png"); this.star5.Source = Animations.GetImage(@"Images/gstar.png"); this.star6.Source = Animations.GetImage(@"Images/gstar.png"); } else if (acces > 10 && acces <= 20) { StarsText.Text = " باقي 5 نجمات أحسنت "; this.star1.Source = Animations.GetImage(@"Images/star.png"); this.star2.Source = Animations.GetImage(@"Images/gstar.png"); this.star3.Source = Animations.GetImage(@"Images/gstar.png"); this.star4.Source = Animations.GetImage(@"Images/gstar.png"); this.star5.Source = Animations.GetImage(@"Images/gstar.png"); this.star6.Source = Animations.GetImage(@"Images/gstar.png"); } else if (acces > 20 && acces <= 30) { StarsText.Text = " باقي 4 نجمات أحسنت "; this.star1.Source = Animations.GetImage(@"Images/star.png"); this.star2.Source = Animations.GetImage(@"Images/star.png"); this.star3.Source = Animations.GetImage(@"Images/gstar.png"); this.star4.Source = Animations.GetImage(@"Images/gstar.png"); this.star5.Source = Animations.GetImage(@"Images/gstar.png"); this.star6.Source = Animations.GetImage(@"Images/gstar.png"); } else if (acces > 30 && acces <= 40) { StarsText.Text = " باقي 3 نجمات أحسنت "; this.star1.Source = Animations.GetImage(@"Images/star.png"); this.star2.Source = Animations.GetImage(@"Images/star.png"); this.star3.Source = Animations.GetImage(@"Images/star.png"); this.star4.Source = Animations.GetImage(@"Images/gstar.png"); this.star5.Source = Animations.GetImage(@"Images/gstar.png"); this.star6.Source = Animations.GetImage(@"Images/gstar.png"); } else if (acces > 40 && acces <= 50) { StarsText.Text = " لم يبقى أمامك الكثير أحسنت "; this.star1.Source = Animations.GetImage(@"Images/star.png"); this.star2.Source = Animations.GetImage(@"Images/star.png"); this.star3.Source = Animations.GetImage(@"Images/star.png"); this.star4.Source = Animations.GetImage(@"Images/star.png"); this.star5.Source = Animations.GetImage(@"Images/gstar.png"); this.star6.Source = Animations.GetImage(@"Images/gstar.png"); } else if (acces > 50 && acces <= 60) { StarsText.Text = " لم يبقى أمامك الكثير أحسنت "; this.star1.Source = Animations.GetImage(@"Images/star.png"); this.star2.Source = Animations.GetImage(@"Images/star.png"); this.star3.Source = Animations.GetImage(@"Images/star.png"); this.star4.Source = Animations.GetImage(@"Images/star.png"); this.star5.Source = Animations.GetImage(@"Images/star.png"); this.star6.Source = Animations.GetImage(@"Images/gstar.png"); } else if (acces > 60) { StarsText.Text = " لقد تحصلت على العلامة الكاملة ! يمكنك الآن إجتياز الإمتحان النهائي "; this.star1.Source = Animations.GetImage(@"Images/star.png"); this.star2.Source = Animations.GetImage(@"Images/star.png"); this.star3.Source = Animations.GetImage(@"Images/star.png"); this.star4.Source = Animations.GetImage(@"Images/star.png"); this.star5.Source = Animations.GetImage(@"Images/star.png"); this.star6.Source = Animations.GetImage(@"Images/star.png"); } }
/****************************************************************************************/ /*La méthode CorrectionQcm affiche la correction de la question courante : * Si la réponse de l’élève correspond à la réponse type « rep=repEleve » * on affiche de plus un commentaire ‘réponse juste ‘, * Sinon on affiche ‘réponse fausse’. * Elle ne retourne rien.*/ private void CorrectionQcm(int rep, int repEleve) { /*Modification de l'interface selon la reponse type rep * Si rep==i ,i={1,2,3} alors on affiche devant le choix 'i' l'image "vrai" * et sa couleur devient vert. la couleur de choix de l'eleve devient rouge * si il est faux et on affiche devant eux l'image "faux"*/ if (rep == 1) { Choix1Rtb.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF27C04C")); comment1.Source = Animations.GetImage(@"Images/True.png"); comment2.Source = Animations.GetImage(@"Images/False.png"); comment3.Source = Animations.GetImage(@"Images/False.png"); } else if (rep == 2) { Choix2Rtb.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF27C04C")); comment2.Source = Animations.GetImage(@"Images/True.png"); comment1.Source = Animations.GetImage(@"Images/False.png"); comment3.Source = Animations.GetImage(@"Images/False.png"); } else { Choix3Rtb.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FF27C04C")); comment3.Source = Animations.GetImage(@"Images/True.png"); comment2.Source = Animations.GetImage(@"Images/False.png"); comment1.Source = Animations.GetImage(@"Images/False.png"); } /***********************************************************/ /*Si la reponse de l'eleve est juste*/ if (rep == repEleve) { score++;//on incrémonte le score. /*on Affiche le score.*/ ScoreShowTB.Inlines.Clear(); ScoreShowTB.Inlines.Add(new Run("النتيجة : " + score + " /8")); /***********************/ /*on affiche un commentaire: bonne reponse*/ Question.Inlines.Clear(); Question.Inlines.Add(new Run("احسنت!اجابة صحيحة.")); /******************************************/ } /*********************************/ /*Si la reponse de l'eleve est fausse*/ else { /*on affiche un commentaire: bonne reponse*/ Question.Inlines.Clear(); Question.Inlines.Add(new Run("للاسف!اجابة خاطئة.")); /****************************************************/ /*Le choix de l'eleve sera en rouge */ if (repEleve == 1) { Choix1Rtb.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFEC0C0C")); } else if (repEleve == 2) { Choix2Rtb.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFEC0C0C")); } else { Choix3Rtb.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFEC0C0C")); } /************************************/ } }