예제 #1
0
        private void DirectionClick()
        {
            MessagePanel.Visible = false;
            if (Direction == Circle.Directions)
            {
                rightAnswer++;
                tests++;
            }
            if (Direction != Circle.Directions)
            {
                tests++;
            }


            if (tests < 3)
            {
                Circle.Set_Circle();
                LandotCirclePictureBox.Image = Circle.ShowImage;
                Point point = new Point((124 - LandotCirclePictureBox.Width / 2), 108 - (LandotCirclePictureBox.Height) / 2);

                LandotCirclePictureBox.Location = point;
            }
            else if (rightAnswer >= 2)
            {
                rightAnswer      = 0;
                left             = Circle.ObjectRow;
                Circle.ObjectRow = (left + right) / 2;
                if (left == 11)
                {
                    Circle.ObjectRow = 12;
                }
                tests = 0;
                Circle.Set_Circle();
                Circle.CalcSize();
                if (left <= 9)
                {
                    LandotCirclePictureBox.Size = new System.Drawing.Size((int)Circle.Get_size().Item1, (int)Circle.Get_size().Item2);
                    Point point = new Point((124 - LandotCirclePictureBox.Width / 2), 108 - (LandotCirclePictureBox.Height) / 2);
                    LandotCirclePictureBox.Location         = point;
                    this.LandotCirclePictureBox.SizeMode    = PictureBoxSizeMode.StretchImage;
                    this.LandotCirclePictureBox.BorderStyle = BorderStyle.None;
                    LandotCirclePictureBox.Image            = Circle.ShowImage;
                }
            }
            else if (rightAnswer < 2)
            {
                right = Circle.ObjectRow;
                if (left < right)
                {
                    Circle.ObjectRow = (left + right) / 2;
                    Circle.CalcSize();
                    if (left <= 9)
                    {
                        LandotCirclePictureBox.Size = new System.Drawing.Size((int)Circle.Get_size().Item1, (int)Circle.Get_size().Item2);
                        Point point = new Point((124 - LandotCirclePictureBox.Width / 2), 108 - (LandotCirclePictureBox.Height) / 2);
                        LandotCirclePictureBox.Location         = point;
                        this.LandotCirclePictureBox.SizeMode    = PictureBoxSizeMode.StretchImage;
                        this.LandotCirclePictureBox.BorderStyle = BorderStyle.None;
                        LandotCirclePictureBox.Image            = Circle.ShowImage;
                        tests = 0;
                    }
                }
            }
            if (left >= right || right == Circle.ObjectRow || left == Circle.ObjectRow)
            {
                if (eye)                //какой глаз сейчас проверяем
                {
                    User.left            = Circle.Get_result(Circle.ObjectRow - 1);
                    eye                  = false;
                    EyeTestPanel.Visible = true;
                    EyeTextLabel.Text    = "Тестуємо праве око.\n Будь ласка, закрийте ліве\n та нажміть ''старт''";
                }
                else
                {
                    User.right = Circle.Get_result(Circle.ObjectRow - 1);

                    User.check_date = DateTime.Now;
                    MyVision.Add_to_file(ref User);
                    AfterTestingForm form = new AfterTestingForm(User);

                    form.Show();
                    this.Hide();
                }
            }
        }
예제 #2
0
        private void AnswerSivtsevButton_Click(object sender, EventArgs e)
        {
            MessagePanel.Visible = false;
            if (AnswerTextBox.Text == NewLetter.Get_Letter())
            {
                rightAnswer++;
            }
            AnswerTextBox.Text = string.Empty;
            //  i++; // Светлана , откуда здесь i?
            tests++;
            if (tests < 3)
            {
                NewLetter.Set_Letter();
                LetterPictureBox.Image = NewLetter.ShowImage;

                Point point = new Point((124 - LetterPictureBox.Width / 2), 108 - (LetterPictureBox.Height) / 2);


                LetterPictureBox.Location = point;
            }
            else if (rightAnswer >= 2)
            {
                rightAnswer         = 0;
                left                = NewLetter.ObjectRow;
                NewLetter.ObjectRow = (left + right) / 2;
                if (left == 11)
                {
                    NewLetter.ObjectRow = 12;
                }
                tests = 0;
                NewLetter.Set_Letter();
                NewLetter.CalcSize();
                if (left <= 9)
                {
                    LetterPictureBox.Size             = new System.Drawing.Size((int)NewLetter.Get_size().Item1, (int)NewLetter.Get_size().Item2);
                    this.LetterPictureBox.SizeMode    = PictureBoxSizeMode.StretchImage;
                    this.LetterPictureBox.BorderStyle = BorderStyle.None;
                    Point point = new Point((124 - LetterPictureBox.Width / 2), 108 - (LetterPictureBox.Height) / 2);
                    LetterPictureBox.Location = point;
                    LetterPictureBox.Image    = NewLetter.ShowImage;
                }
            }

            else
            {
                right = NewLetter.ObjectRow;
                if (left < right)
                {
                    NewLetter.ObjectRow = (left + right) / 2;
                    NewLetter.CalcSize();



                    if (left <= 9)
                    {
                        LetterPictureBox.Size             = new System.Drawing.Size((int)NewLetter.Get_size().Item1, (int)NewLetter.Get_size().Item2);
                        this.LetterPictureBox.SizeMode    = PictureBoxSizeMode.StretchImage;
                        this.LetterPictureBox.BorderStyle = BorderStyle.None;
                        Point point = new Point((124 - LetterPictureBox.Width / 2), 108 - (LetterPictureBox.Height) / 2);
                        LetterPictureBox.Location = point;
                        LetterPictureBox.Image    = NewLetter.ShowImage;
                    }


                    tests = 0;
                }
            }
            if (left >= right || right == NewLetter.ObjectRow || left == NewLetter.ObjectRow)
            {
                if (eye)    //какой глаз сейчас проверяем
                {
                    User.left                   = NewLetter.Get_result(NewLetter.ObjectRow - 1);
                    eye                         = false;
                    timer1.Enabled              = false;
                    EyeTestPanel.Visible        = true;
                    AnswerSivtsevButton.Enabled = false;
                    EyeTextLabel.Text           = "Тестуємо праве око.\n Будь ласка, закрийте ліве\n та нажміть ''старт''";
                    // вставить предупреждение про проверку левого глаза
                }
                else
                {
                    User.right = NewLetter.Get_result(NewLetter.ObjectRow - 1);

                    User.check_date = DateTime.Now;
                    MyVision.Add_to_file(ref User);

                    AfterTestingForm form = new AfterTestingForm(User);
                    form.Show();
                    this.Hide();
                }
            }



            SivtsevTimer.Value = 0;
            temp           = 6;           // temp=i;
            timer1.Enabled = true;
        }