private void addQuestionToForm(object sender, RoutedEventArgs e) { try { Question question = new Question { Sentence = SentenceTxt.Text, ValidAnswer = Right.Text, WrongAnswer = Wrong.Text, IdForm = IdForm, Points = Int32.Parse(Pointxt.Text) }; bool success = question.addQuestion(question); if (success) { QuizzQuestionsPage page = new QuizzQuestionsPage(id); NavigationService.Navigate(page); } else { MessageBox.Show("Veillez à renseigner tout les champs"); } }catch (FormatException) { MessageBox.Show("Veillez à renseigner tout les champs"); } }
private void modifyForm(object sender, RoutedEventArgs e) { string idFormToModify = (((Button)sender).Tag).ToString(); QuizzQuestionsPage page = new QuizzQuestionsPage(idFormToModify); NavigationService.Navigate(page); }
private void displayModification(object sender, RoutedEventArgs e) { string idquestionToModify = (((Button)sender).Tag).ToString(); int questionId = Int32.Parse(idquestionToModify); ModifyQuestionWindow popup = new ModifyQuestionWindow(questionId, IdForm); popup.ShowDialog(); QuizzQuestionsPage page = new QuizzQuestionsPage(IdForm.ToString()); NavigationService.Navigate(page); }
private void saveModifiedQuestion(object sender, RoutedEventArgs e) { infoTextBlock.Text = ""; bool success = true; Question question = new Question(); //pointsTxt // success = question.updateQuestion(question); if (!success) { infoTextBlock.Text += "Echec : Une erreur est survenue lors de la modification\n"; return; } else { QuizzQuestionsPage page = new QuizzQuestionsPage(IdForm.ToString()); NavigationService.Navigate(page); } }