Exemplo n.º 1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (enabled)
            {
                if (seconds_left < 0)
                {
                    int minutestoseconds = duration_minutes * 60;
                    int seconds          = duration_seconds;
                    int totaltime        = minutestoseconds + seconds;
                    seconds_left = totaltime;
                }

                // https://stackoverflow.com/a/3665061
                var timespan = TimeSpan.FromSeconds(seconds_left);
                lbl_TimeLeft.Text = (timespan.ToString(@"mm\:ss"));

                seconds_left -= 1;
                if (seconds_left == 0)
                {
                    frmReminder rem = new frmReminder(timespan_minutes, timespan_seconds);
                    rem.Show();
                    enabled = false;
                }
            }
        }
Exemplo n.º 2
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (enabled)
     {
         if (seconds_left < 0)
         {
             int minutestoseconds = duration_minutes * 60;
             int seconds          = duration_seconds;
             int totaltime        = minutestoseconds + seconds;
             seconds_left = totaltime;
         }
         label1.Text   = seconds_left.ToString();
         seconds_left -= 1;
         if (seconds_left == 0)
         {
             frmReminder rem = new frmReminder(timespan_minutes, timespan_seconds);
             rem.Show();
             enabled = false;
         }
     }
 }