Ejemplo n.º 1
0
        private void countDown(object sender, EventArgs e)
        {
            if (final != DateTime.MinValue)
            {
                timeLeft = final - DateTime.Now;
            }

            else
            {
                timeLeft = timeLeft.Subtract(new TimeSpan(0, 0, 1));
            }

            int days  = timeLeft.Days % 7;
            int weeks = (timeLeft.Days - days) / 7;

            string countDownText = BaseCountDownText + "\n" + weeks + "                 " + days + "                  " + timeLeft.Hours +
                                   "               " + timeLeft.Minutes + "                    " + timeLeft.Seconds;

            lblCountDown.Text = countDownText;

            if (timeLeft == new TimeSpan(0, 0, 0, 0))
            {
                CountDownTimer.Stop();
                MessageBox.Show("Time's up");
            }
        }
Ejemplo n.º 2
0
 private void btnStop_Click(object sender, EventArgs e)
 {
     CountDownTimer.Stop();
 }