Exemplo n.º 1
0
        private void ImportButton_Click(object sender, EventArgs e)
        {
            if (inputFileDialog.ShowDialog() == DialogResult.OK)
            {
                ImportButton.Enabled = false;
                List <string>   lines     = Reader.ReadFile(inputFileDialog.FileName);
                List <Question> questions = new List <Question>();

                UploadExam exam = new UploadExam(lines[0]); lines.RemoveAt(0);
                foreach (string line in lines)
                {
                    questions.Add(new Question(line));
                }
                exam.Questions = questions.ToArray();
                WebRequest.UploadExam(exam, (res) =>
                {
                    if (res.IsSucces())
                    {
                        Reload();
                    }
                    else
                    {
                        MessageBox.Show("Hiba történt vizsga feltöltés közben!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    ImportButton.Enabled = true;
                });
            }
        }
Exemplo n.º 2
0
 public static void UploadExam(UploadExam exam, Action <WebResponse> callback)
 {
     JPost(HOST + "/exams", JsonConvert.SerializeObject(exam), callback);
 }