Ejemplo n.º 1
0
        private void ShutDownTm_Tick(object sender, EventArgs e)
        {
            timeLeft      = timeLeft.Subtract(TimeSpan.FromSeconds(1));
            lblTimer.Text = timeLeft.ToString(@"hh\:mm\:ss");

            if (timeLeft.TotalSeconds <= 0)
            {
                ShutDownTm.Stop();
                PerformAction();
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            CheckTextBoxValues();
            bool isStartable = true;

            try
            {
                timeLeft = new TimeSpan(Convert.ToInt32(Hours.Text), Convert.ToInt32(Mins.Text), Convert.ToInt32(Secs.Text));
            }

            catch (FormatException)
            {
                isStartable = false;
                MessageBox.Show("False Format!");
            }

            if (isStartable == true)
            {
                ShutDownTm.Start();
                lblTimer.Text = timeLeft.ToString(@"hh\:mm\:ss");
            }
        }
Ejemplo n.º 3
0
 private void button2_Click(object sender, EventArgs e)
 {
     ShutDownTm.Stop();
 }