Example #1
0
        private void BtnStart_Click(object sender, EventArgs e)
        {
            if (isGameStart == false)
            {
                startTime       = DateTime.Now;
                stopTime1       = stopTime2 = startTime;
                sec24           = sec24stop1 = sec24stop2 = startTime;
                startTime       = startTime.Add(new TimeSpan(0, 0, min, sec));
                sec24           = sec24.Add(new TimeSpan(0, 0, 0, 24));
                isGameStart     = true;
                btn24start.Text = "Pause";
            }
            if (btnStart.Text == "Pause")
            {
                stopTime1       = DateTime.Now;
                sec24stop1      = stopTime1;
                btnStart.Text   = "Start";
                btn24start.Text = "Start";

                SYNC.Stop();
                SYNC24.Stop();
            }
            else
            {
                stopTime2       = DateTime.Now;
                sec24stop2      = stopTime2;
                startTime      += stopTime2 - stopTime1;
                sec24          += sec24stop2 - sec24stop1;
                btnStart.Text   = "Pause";
                btn24start.Text = "Pause";

                SYNC.Start();
                SYNC24.Start();
            }
        }
Example #2
0
 private void Btn24start_Click(object sender, EventArgs e)
 {
     if (btnStart.Text == "Pause")
     {
         if (btn24start.Text == "Pause")
         {
             sec24stop1      = DateTime.Now;
             btn24start.Text = "Start";
             SYNC24.Stop();
         }
         else if (btn24start.Text == "Start")
         {
             sec24stop2      = DateTime.Now;
             sec24          += sec24stop2 - sec24stop1;
             btn24start.Text = "Pause";
             SYNC24.Start();
         }
     }
 }