Пример #1
0
        private void InitTest(SimplyTest test)
        {
            if (test.Question?.StringValue != null)
            {
                this.labelQuestionBody.Text = test.Question.StringValue;
            }
            this.pictureBox1.Image    = test.Questions.First().ImageValue;
            this.pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;

            this.pictureBox2.Image    = test.Questions.Last().ImageValue;
            this.pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage;


            labelQuestionTitle.Text = "Вопрос Номер: " + (this.currentTestIndex + 1);



            int counter = 0;

            foreach (var el in test.Variables)
            {
                try
                {
                    this.Controls["pictureBoxAnswer" + (++counter)].BackgroundImage = el.ImageValue;
                }
                catch (Exception ee)
                {
                    MessageBox.Show("Упс, что то пошло не так!");
                }
            }
            for (int i = counter + 1; i <= MAX_BLOCKS_SIZE; i++)
            {
                this.Controls["pictureBoxAnswer" + i].Visible = false;
            }
        }
Пример #2
0
        public TestForm2(List <SimplyTest> tests, PupilSelectionWindow callback)
        {
            this.callback = callback;

            InitializeComponent();
            this.testCollection = tests;
            this.CurrentTest    = this.testCollection.FirstOrDefault();
        }
Пример #3
0
        private void InitTest(SimplyTest test)
        {
            if (test.Question?.StringValue != null)
            {
                this.labelQuestionBody.Text = test.Question.StringValue;
            }
            this.pictureBox1.Image    = test.Questions.First().ImageValue;
            this.pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;

            this.pictureBox2.Image    = test.Questions.Last().ImageValue;
            this.pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage;


            labelQuestionTitle.Text = "Вопрос Номер: " + this.parent.TestNumber.ToString();
            currentTestNumber++;


            int counter = 0;

            foreach (var el in test.Variables)
            {
                try
                {
                    this.Controls["pictureBoxAnswer" + (++counter)].BackgroundImage = el.ImageValue;
                }
                catch (Exception ee)
                {
                    MessageBox.Show("Упс, что то пошло не так!");
                }
            }
            for (int i = counter + 1; i <= MAX_BLOCKS_SIZE; i++)
            {
                this.Controls["pictureBoxAnswer" + i].Visible = false;
            }

            var pics = new List <PictureBox>()
            {
                this.pictureBoxAnswer1,
                this.pictureBoxAnswer2,
                this.pictureBoxAnswer3,
                this.pictureBoxAnswer4,
                this.pictureBoxAnswer5,
                this.pictureBoxAnswer6,
                this.pictureBoxAnswer7,
                this.pictureBoxAnswer8
            };

            for (int i = 0; i < pics.Count; i++)
            {
                pics[i].Top  = picsCoords[i][0];
                pics[i].Left = picsCoords[i][1];
            }
        }
Пример #4
0
        //private void checkBoxClick(object sender, EventArgs e)
        //{
        //    if (this.AnswersCount == 1)
        //    {
        //        var currentCheckBox = sender as CheckBox;
        //        var currentCheckBoxName = currentCheckBox.Name;
        //        this.SelectedCheckBoxIdx = int.Parse(currentCheckBox.Name.Substring(currentCheckBox.Name.Length - 1));
        //        var checkBoxArrayToCheck = new List<CheckBox>()
        //        {
        //            this.checkBox1,
        //            this.checkBox2,
        //            this.checkBox3,
        //            this.checkBox4,
        //            this.checkBox5,
        //            this.checkBox6,
        //            this.checkBox7,
        //        };

        //        foreach (CheckBox box in checkBoxArrayToCheck)
        //        {
        //            if (box.Name != currentCheckBoxName)
        //            {
        //                box.Checked = false;
        //            }
        //            else
        //            {
        //                box.Checked = true;
        //            }
        //        }
        //    }
        //    if (this.currentTestIndex == this.testCollection.Count - 1)
        //    {
        //        buttonNext.Text = FINISH_STRING;
        //    }
        //}

        private void buttonNext_Click(object sender, EventArgs e)
        {
            if (this.CurrentTest.RightIdx == this.SelectedCheckBoxIdx)
            {
                this.RightAnswersCount++;
            }
            if (currentTestIndex < testCollection.Count - 1)
            {
                this.CurrentTest = testCollection[++currentTestIndex];
                QuestionInit(this.CurrentTest);
            }
            else
            {
                MessageBox.Show("Тестирование окончено\n\rВерных ответов: " + this.RightAnswersCount);
                this.Hide();
                this.callback.Show();
            }
        }
Пример #5
0
        private void InitTest(SimplyTest test)
        {
            SummaryFailCount            = 0;
            this.labelQuestionBody.Text = test.Question.StringValue;

            this.pictureBoxQuestion1.Image = test.Question.ImageValue;
            pictureBoxQuestion1.SizeMode   = PictureBoxSizeMode.StretchImage;


            labelQuestionTitle.Text = "Вопрос Номер: " + (this.callback.TestNumber.ToString());

            for (int i = 1; i <= MAX_BLOCKS_SIZE; i++)
            {
                var checkBox = this.Controls["checkBox" + i] as CheckBox;
                checkBox.Checked = false;
            }


            int counter = 0;

            foreach (var el in test.Variables)
            {
                try {
                    this.Controls["checkBox" + (++counter)].Text            = el.StringValue;
                    this.Controls["pictureBox" + (counter)].BackgroundImage = el.ImageValue;
                } catch (Exception ee)
                {
                    MessageBox.Show("Упс, что-то пошло не так!");
                }
            }
            for (int i = 1; i <= MAX_BLOCKS_SIZE; i++)
            {
                if (i < counter + 1)
                {
                    this.Controls["checkBox" + i].Visible   = true;
                    this.Controls["pictureBox" + i].Visible = true;
                }
                else
                {
                    this.Controls["checkBox" + i].Visible   = false;
                    this.Controls["pictureBox" + i].Visible = false;
                }
            }
        }
Пример #6
0
        private void InitTest(SimplyTest test)
        {
            this.labelQuestionBody.Text = test.Question.StringValue;
            if (test.Question.ImageValue != null)
            {
                this.pictureBoxQuestion1.Image = test.Question.ImageValue;
                pictureBoxQuestion1.SizeMode   = PictureBoxSizeMode.StretchImage;
            }

            labelQuestionTitle.Text = "Вопрос Номер: " + (this.currentTestIndex + 1);

            for (int i = 1; i <= MAX_BLOCKS_SIZE; i++)
            {
                var checkBox = this.Controls["checkBox" + i] as CheckBox;
                checkBox.Checked = false;
            }


            int counter = 0;

            foreach (var el in test.Variables)
            {
                try {
                    this.Controls["checkBox" + (++counter)].Text            = el.StringValue;
                    this.Controls["pictureBox" + (counter)].BackgroundImage = el.ImageValue;
                } catch (Exception ee)
                {
                    MessageBox.Show("Упс, что то пошло не так!");
                }
            }
            for (int i = counter + 1; i <= MAX_BLOCKS_SIZE; i++)
            {
                this.Controls["checkBox" + i].Visible   = false;
                this.Controls["pictureBox" + i].Visible = false;
            }
        }