Example #1
0
        private void splitContainerTask2_KeyUp(object sender, KeyEventArgs e)
        {
            if (flag && e.KeyCode == Keys.Space)
            {
                flag = false;
            }
            if (!(CirclePictureBox.Visible || TrianglePictureBox.Visible || SquarePictureBox.Visible) &&
                (e.KeyCode == Keys.A || e.KeyCode == Keys.S || e.KeyCode == Keys.D))
            {
                textBox1.Clear();
                textBox1.Text += time_reaction.Elapsed;

                result[position] = time_reaction.Elapsed;
                position++;


                if (position == 10)
                {
                    time_reaction.Stop();
                    TimerCircle.Stop();
                    TimerTriangle.Stop();
                    TimerSquare.Stop();
                    CirclePictureBox.Location   = new Point(splitContainerTask2.Panel1.Width / 2 - 20, splitContainerTask2.Panel1.Height / 2 - 20);
                    TrianglePictureBox.Location = new Point(splitContainerTask2.Panel1.Width / 2 - 65, splitContainerTask2.Panel1.Height / 2 - 20);
                    SquarePictureBox.Location   = new Point(splitContainerTask2.Panel1.Width / 2 + 25, splitContainerTask2.Panel1.Height / 2 - 20);
                    _file_manager.CreatAndSaveFile(result, "Task2");
                    //_file_manager.CreatAndSaveErrorFile(number, error_time, "TimeErrorTask1");

                    if (MessageBox.Show("Задание успешно выполнено успешно выполенено") == DialogResult.OK)
                    {
                        // Close();
                    }
                }
            }
        }
Example #2
0
 private void TimerSquare_Tick(object sender, EventArgs e)
 {
     TimerSquare.Stop();
     SquarePictureBox.Location = new Point(random.Next(4, splitContainerTask2.Panel1.Width - 44),
                                           random.Next(4, splitContainerTask2.Panel1.Height - 44));
     SquarePictureBox.Visible = true;
     time_reaction.Restart();
 }