コード例 #1
0
        private void ButtomCountdownTimer_Tick(object sender, EventArgs e)
        {
            if (timeLeft > 0)
            {
                timeLeft = timeLeft - 1;
                tooSoon  = true;
            }
            else
            {
                tooSoon = false;
                //button1.Enabled = true;
                ButtomCountdownTimer.Stop();
                button1.BackColor = Color.Green;
                //sum.Value = timeCalc1 + timeCalc2;

                timeLeft = 0;
                stopwatch.Start();
            }
        }
コード例 #2
0
        public void EndTest()
        {
            testActive = false;
            testNumber++;
            ButtomCountdownTimer.Stop();
            button1.BackColor = Color.Yellow;
            button1.Text      = "";
            stopwatch.Stop();
            //int elapsedTime = (int));
            decimal reactionTime = stopwatch.ElapsedMilliseconds - 100;

            button1.Text       = reactionTime + "ms" + Environment.NewLine + "Press any key to try again";
            totalReactionTime += (int)reactionTime;
            label1.Text        = testNumber + " RECENT ATTMEPTS (AVERAGE: " + (totalReactionTime / testNumber) + "ms)" + Environment.NewLine;
            label2.Text       += reactionTime + Environment.NewLine;
            stopwatch.Reset();
            //button1.Enabled = true;
            button2.Enabled = true;
        }