Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        private DialogResult ShowAddAnswerForm(string data)
        {
            AddAnswerForm addForm = new AddAnswerForm();

            CallBackMy.callbackEventHandler(data);
            return(addForm.ShowDialog());
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (tbAnswerText.Text.Length != 0)
     {
         if (CallBackMy.AddQuestionTextEventHandler != null)
         {
             CallBackMy.AddQuestionTextEventHandler(tbAnswerText.Text);
         }
     }
     DialogResult = DialogResult.OK;
 }