/// <summary> /// Event triggered when the Manche 3 "Previous" button is pressed /// </summary> private void manche3Previous_Click(object sender, RoutedEventArgs e) { if (manche3Question.IsChecked == true) { compteurQuestionsManche3--; currentElement = elementsManche3[0][compteurQuestionsManche3-1]; File.WriteAllText("question.txt", ((Question)currentElement).question); File.WriteAllText("reponse.txt", ""); this.manche3LabelElement.Content = "Question n°" + compteurQuestionsManche3; if (compteurQuestionsManche3 == 1) { this.manche3Previous.IsEnabled = false; } this.manche3Button.IsEnabled = true; this.manche3Next.IsEnabled = true; } else if (manche3Musique.IsChecked == true) { compteurMusiquesManche3--; currentElement = elementsManche3[1][compteurMusiquesManche3-1]; File.WriteAllText("question.txt", ((Musique)currentElement).indice); File.WriteAllText("reponse.txt", ""); this.manche3LabelElement.Content = "Musique n°" + compteurMusiquesManche3; if (compteurMusiquesManche3 == 1) { this.manche3Previous.IsEnabled = false; } this.manche3Button.IsEnabled = true; this.manche3Next.IsEnabled = true; } else if (manche3Devinette.IsChecked == true) { compteurDevinettesManche3--; currentElement = elementsManche3[2][compteurDevinettesManche3-1]; File.WriteAllText("question.txt", ((Devinette)currentElement).indice); File.WriteAllText("reponse.txt", ""); this.manche3LabelElement.Content = "Devinette n°" + compteurDevinettesManche3; if (compteurDevinettesManche3 == 1) { this.manche3Previous.IsEnabled = false; } this.manche3Button.IsEnabled = true; this.manche3Next.IsEnabled = true; } }
/// <summary> /// Event triggered when the Manche 3 "X suivante" button is pressed /// </summary> private void manche3Button_Click(object sender, RoutedEventArgs e) { if (manche3Question.IsChecked == true) { playSound(0); compteurQuestionsManche3++; currentElement = elementsManche3[0][compteurQuestionsManche3-1]; File.WriteAllText("question.txt", ((Question)currentElement).question); File.WriteAllText("reponse.txt", ""); this.manche3LabelElement.Content = "Question n°" + compteurQuestionsManche3; if (compteurQuestionsManche3 == 1) { this.manche3Button.Content = "Question suivante"; this.manche3Previous.IsEnabled = false; this.manche3Next.IsEnabled = true; this.manche3LabelElement.Visibility = System.Windows.Visibility.Visible; } else if (compteurQuestionsManche3 == elementsManche3[0].Count()) { this.manche3Button.IsEnabled = false; this.manche3Previous.IsEnabled = true; this.manche3Next.IsEnabled = false; } else { this.manche3Button.IsEnabled = true; this.manche3Previous.IsEnabled = true; this.manche3Next.IsEnabled = true; } } else if (manche3Musique.IsChecked == true) { playSound(0); compteurMusiquesManche3++; currentElement = elementsManche3[1][compteurMusiquesManche3-1]; File.WriteAllText("question.txt", ((Musique)currentElement).indice); File.WriteAllText("reponse.txt", ""); this.manche3LabelElement.Content = "Musique n°" + compteurMusiquesManche3; if (compteurQuestionsManche3 == 1) { this.manche3Button.Content = "Musique suivante"; this.manche3Previous.IsEnabled = false; this.manche3Next.IsEnabled = true; this.manche3LabelElement.Visibility = System.Windows.Visibility.Visible; } else if (compteurMusiquesManche3 == elementsManche3[1].Count()) { this.manche3Button.IsEnabled = false; this.manche3Previous.IsEnabled = true; this.manche3Next.IsEnabled = false; } else { this.manche3Button.IsEnabled = true; this.manche3Previous.IsEnabled = true; this.manche3Next.IsEnabled = true; } } else if (manche3Devinette.IsChecked == true) { playSound(0); compteurDevinettesManche3++; currentElement = elementsManche3[2][compteurDevinettesManche3-1]; File.WriteAllText("question.txt", ((Devinette)currentElement).indice); File.WriteAllText("reponse.txt", ""); this.manche3LabelElement.Content = "Devinette n°" + compteurDevinettesManche3; if (compteurDevinettesManche3 == 1) { this.manche3Button.Content = "Devinette suivante"; this.manche3Previous.IsEnabled = false; this.manche3Next.IsEnabled = true; this.manche3LabelElement.Visibility = System.Windows.Visibility.Visible; } else if (compteurDevinettesManche3 == elementsManche3[2].Count()) { this.manche3Button.IsEnabled = false; this.manche3Previous.IsEnabled = true; this.manche3Next.IsEnabled = false; } else { this.manche3Button.IsEnabled = true; this.manche3Previous.IsEnabled = true; this.manche3Next.IsEnabled = true; } } }
/// <summary> /// Event triggered when the Manche 2 "Previous" button is pressed /// </summary> private void manche2Previous_Click(object sender, RoutedEventArgs e) { compteurManche2--; currentElement = musiquesManche2[compteurManche2-1]; File.WriteAllText("question.txt", ((Musique)currentElement).indice); File.WriteAllText("reponse.txt", ""); this.manche2Number.Content = compteurManche2; this.manche2Ratio.Content = compteurManche2 + "/" + musiquesManche2.Count().ToString(); this.manche2Points.Content = ((Musique)musiquesManche2[compteurManche2 - 1]).points.ToString(); if (compteurManche2 == 1) { this.manche2Previous.IsEnabled = false; } this.manche2Button.IsEnabled = true; this.manche2Next.IsEnabled = true; }
/// <summary> /// Event triggered when the Manche 2 "Next" button is pressed /// </summary> private void manche2Next_Click(object sender, RoutedEventArgs e) { compteurManche2++; currentElement = musiquesManche2[compteurManche2-1]; File.WriteAllText("question.txt", ((Musique)currentElement).indice); File.WriteAllText("reponse.txt", ""); this.manche2Number.Content = compteurManche2; this.manche2Ratio.Content = compteurManche2 + "/" + musiquesManche2.Count().ToString(); this.manche2Points.Content = ((Musique)musiquesManche2[compteurManche2 - 1]).points.ToString(); if (compteurManche2 == 1) { this.manche2Button.Content = "Musique suivante"; this.manche2Previous.IsEnabled = false; this.manche2Next.IsEnabled = true; this.manche2LabelQuestion.Visibility = System.Windows.Visibility.Visible; this.manche2LabelPoints.Visibility = System.Windows.Visibility.Visible; this.manche2Number.Visibility = System.Windows.Visibility.Visible; this.manche2Ratio.Visibility = System.Windows.Visibility.Visible; } else if (compteurManche2 == musiquesManche2.Count()) { this.manche2Button.IsEnabled = false; this.manche2Previous.IsEnabled = true; this.manche2Next.IsEnabled = false; } else { this.manche2Button.IsEnabled = true; this.manche2Previous.IsEnabled = true; this.manche2Next.IsEnabled = true; } }
/// <summary> /// Event triggered when the Manche 1 "Previous" button is pressed /// </summary> private void manche1Previous_Click(object sender, RoutedEventArgs e) { compteurManche1--; currentElement = questionsManche1[compteurManche1-1]; File.WriteAllText("question.txt", ((Question)currentElement).question); File.WriteAllText("reponse.txt", ""); this.manche1Number.Content = compteurManche1; this.manche1Ratio.Content = compteurManche1 + "/" + questionsManche1.Count().ToString(); this.manche1Points.Content = ((Question)questionsManche1[compteurManche1 - 1]).points.ToString(); if (compteurManche1 == 1) { this.manche1Previous.IsEnabled = false; } this.manche1Button.IsEnabled = true; this.manche1Next.IsEnabled = true; }
/// <summary> /// Event triggered when the Manche 1 "Next" button is pressed /// </summary> private void manche1Next_Click(object sender, RoutedEventArgs e) { compteurManche1++; currentElement = questionsManche1[compteurManche1-1]; File.WriteAllText("question.txt", ((Question)currentElement).question); File.WriteAllText("reponse.txt", ""); this.manche1Number.Content = compteurManche1; this.manche1Ratio.Content = compteurManche1 + "/" + questionsManche1.Count().ToString(); this.manche1Points.Content = ((Question)questionsManche1[compteurManche1 - 1]).points.ToString(); if (compteurManche1 == 1) { this.manche1Button.Content = "Question suivante"; this.manche1Previous.IsEnabled = false; this.manche1Next.IsEnabled = true; this.manche1LabelQuestion.Visibility = System.Windows.Visibility.Visible; this.manche1LabelPoints.Visibility = System.Windows.Visibility.Visible; this.manche1Number.Visibility = System.Windows.Visibility.Visible; this.manche1Ratio.Visibility = System.Windows.Visibility.Visible; } else if (compteurManche1 == questionsManche1.Count()) { this.manche1Button.IsEnabled = false; this.manche1Previous.IsEnabled = true; this.manche1Next.IsEnabled = false; } else { this.manche1Button.IsEnabled = true; this.manche1Previous.IsEnabled = true; this.manche1Next.IsEnabled = true; } }