Esempio n. 1
0
 private void Continue_Click(object sender, EventArgs e)
 {
     try
     {
         DataFileManager dataManager = new DataFileManager(usernameToGuess, testName);
         dataManager.updateDirectoryTests();
         Console.WriteLine(dataManager.getFilePath());
         lines      = dataManager.getTestData(testName, username, dataManager.getFilePath());
         lineAmount = lines.Count();
         //i'm still getting more lines than needed, so here is workaround
         foreach (string line in lines)
         {
             //Console.WriteLine("line: {0}",line);
             if (String.IsNullOrEmpty(line))
             {
                 //Console.WriteLine("null line: {0}", line);
                 lineAmount--;
             }
         }
         QuestionAmountLabel.Text += lineAmount.ToString();
         questionNumber.Text      += "1";
         panel2.Hide();
         loadTest();
     }
     catch (ArgumentNullException ex)
     {
         Console.WriteLine(ex);
         MessageBox.Show("No such test exists, please try again");
     }
 }
Esempio n. 2
0
        private void replaceButton_Click(object sender, EventArgs e)
        {
            DataFileManager dataManager = new DataFileManager(username, testName);

            dataManager.updateDirectoryTests();
            dataManager.writeToFile(dataManager.getFilePath(), qList, false);
            this.Close();
        }
Esempio n. 3
0
        private void loadComboBox()
        {
            DataFileManager dataManager = new DataFileManager(usernameToGuess, testName, username);

            dataManager.updateDirectoryTests();
            string[] files = Directory.GetFiles(dataManager.getDirectoryPath());
            foreach (string file in files)
            {
                comboBox1.Items.Add(Path.GetFileName(file));
            }
        }
Esempio n. 4
0
        private void testEnd_Click(object sender, EventArgs e)
        {
            DataFileManager dataManager = new DataFileManager(username, testName);

            dataManager.updateDirectoryTests();
            if (!dataManager.fileExists())
            {
                dataManager.createDirectory(dataManager.getDirectoryPath());
                dataManager.writeToFile(dataManager.getFilePath(), qList, true);
                this.Close();
            }
            if (dataManager.fileExists())
            {
                sameFilePanel.Show();
            }
        }