public TestForm() { string fileName; InitializeComponent(); string[] files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.xml"); if (files.Length == 1) { fileName = files[0]; } else { SelectFileForm selectForm = new SelectFileForm(); CallBackMy.FillFileNameEventHendler(new List <string>(files)); selectForm.ShowDialog(); fileName = selectForm.SelectFile; } loader = new QuestionsLoader(); if (File.Exists(fileName)) { loader.LoadQuestions(fileName); CallBackMy.ShowQuestionEventHendler = ShowQuestion; CallBackMy.ShowTestResult = ShowResultTestDetail; CallBackMy.QuestionResultEnentHandler = QuestionResult; loader.StartTest(); } else { MessageBox.Show("Файл тестов не найден"); btAnswer.Enabled = false; } }
private DialogResult ShowAddAnswerForm(string data) { AddAnswerForm addForm = new AddAnswerForm(); CallBackMy.callbackEventHandler(data); return(addForm.ShowDialog()); }
private void ShowResultTestDetail(string student, string group, int valid, int novalid) { ResultForm resultForm = new ResultForm(); CallBackMy.ShowTestResultDetail(student, group, valid, novalid); resultForm.ShowDialog(); Application.Exit(); }
private void button2_Click(object sender, EventArgs e) { if (tbAnswerText.Text.Length != 0) { if (CallBackMy.AddQuestionTextEventHandler != null) { CallBackMy.AddQuestionTextEventHandler(tbAnswerText.Text); } } DialogResult = DialogResult.OK; }