//BUTTON private void BtnStart(object sender, RoutedEventArgs e) { QuizzDictionary.EmptyDictionaryQuiz(); if (rbFull.IsChecked == true) { MakeQuizFull(); this.Close(); main.ShowDialog(); } else if (rbOneDictionary.IsChecked == true) { if (CbChoseOneDictionary.SelectedItem != null) { MakeQuizOneDictionary(); this.Close(); main.ShowDialog(); } else { System.Windows.MessageBox.Show("Please chose your one dictionary that you want to test", "Chose one dictionary", MessageBoxButton.OK); CbChoseOneDictionary.Focus(); } } else { System.Windows.MessageBox.Show("Please chose your test type !", "Chose test type", MessageBoxButton.OK); } }
private void BtnFinish_Click(object sender, RoutedEventArgs e) { if (!String.IsNullOrWhiteSpace(TbNameOfTest.Text)) { Test mainTest = new Test { DateOfTest = DateTime.Now, Correct = QuizzDictionary.BrojTacno, Inccorect = QuizzDictionary.BrojNetacno, NameOfTest = TbNameOfTest.Text, UserID = LoginUserData.UseridLOG, NumberOfWordsTested = i, PercentageOfCorrect = Math.Round(Convert.ToDouble(QuizzDictionary.BrojTacno) / Convert.ToDouble(i) * 100, 2), }; DC.Tests.InsertOnSubmit(mainTest); try { DC.SubmitChanges(); MessageBox.Show("Test Saved\nYou Answerd correct on " + QuizzDictionary.BrojTacno + " questions\n" + "You had " + QuizzDictionary.BrojNetacno + " Incorrect answers\nYou test is saved!"); UpisiRezultate(); } catch (Exception ex) { MessageBox.Show("Oh Something went wrong here ! " + ex); } finally { QuizzDictionary.EmptyDictionaryQuiz(); QuizzDictionary.EmptyResults(); MainWindow window = new MainWindow(); this.Close(); window.Show(); } } else { MessageBox.Show("Please make sure you name your test !"); } }