Esempio n. 1
0
 private void SplitContainerPictInst_KeyDown(object sender, KeyEventArgs e)
 {
     if (flag && e.KeyCode == Keys.Space)
     {
         FirstKeyDown();
         TimerPicture.Start();
     }
     else if (e.KeyCode == Keys.Space && !TimerPicture.Enabled)
     {
         FirstKeyDown();
         time_reaction.Stop();
     }
     else
     {
         if (e.KeyCode == Keys.Space)
         {
             //MessageBox.Show("Двойной клик");
             number.Add(position);
             error_time.Add(time_reaction.Elapsed);
         }
     }
     if (e.KeyCode != Keys.Space)
     {
         if (MessageBox.Show("Вы ошиблись клавишой \n Упражнение начнется сначала") == DialogResult.OK)
         {
             position = 0;
             flag     = true;
             time_reaction.Reset();
             TimerPicture.Stop();
             CircleBox.Visible  = true;
             CircleBox.Location = new Point(SplitContainerPictInst.Panel1.Width / 2 - 20, SplitContainerPictInst.Panel1.Height / 2 - 20);
         }
     }
 }
Esempio n. 2
0
        private void SplitContainerPictInst_KeyUp(object sender, KeyEventArgs e)
        {
            if (flag && e.KeyCode == Keys.Space)
            {
                flag = false;
            }
            else if (!TimerPicture.Enabled && e.KeyCode == Keys.Space && position < 10)
            {
                TimerPicture.Start();
                textBox1.Clear();


                textBox1.Text += time_reaction.Elapsed;

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

                if (position == 10)
                {
                    time_reaction.Stop();
                    TimerPicture.Stop();
                    CircleBox.Location = new Point(SplitContainerPictInst.Panel1.Width / 2 - 20, SplitContainerPictInst.Panel1.Height / 2 - 20);
                    _file_manager.CreatAndSaveFile(result, "Task1");
                    _file_manager.CreatAndSaveErrorFile(number, error_time, "TimeErrorTask1");

                    if (MessageBox.Show("Задание успешно выполнено успешно выполенено") == DialogResult.OK)
                    {
                        // Close();
                    }
                }
                time_reaction.Restart();
            }
        }
Esempio n. 3
0
 private void TimerPicture_Tick(object sender, EventArgs e)
 {
     TimerPicture.Stop();
     CircleBox.Location = new Point(random.Next(4, SplitContainerPictInst.Panel1.Width - 44),
                                    random.Next(4, SplitContainerPictInst.Panel1.Height - 44));
     CircleBox.Visible = true;
     time_reaction.Restart();
 }