using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace timer
{
class Program
{
static void Main(string[] args)
{
CH3COOHTimer timer = new CH3COOHTimer(60);
timer.Run();
}
}
public class CH3COOHTimer
{
int LimitSec = 0;
public CH3COOHTimer(int sec)
{
LimitSec = sec;
}
public void TimerCB(object obj)
{
Console.Clear();
Console.WriteLine(string.Format("残り:{0}分", LimitSec));
LimitSec--;
}
public void Run()
{
TimerCallback timerCB = new TimerCallback(TimerCB);
Timer timer = new Timer(timerCB, null, 0, 60000);
while (LimitSec != 0)
{
Thread.Sleep(5000);
}
}
}
}