public class Class1
{
static void Main()
{
AutoResetEvent autoEvent = new AutoResetEvent(false);
StatusChecker statusChecker = new StatusChecker();
TimerCallback timerDelegate =
new TimerCallback(statusChecker.CheckStatus); Console.WriteLine("{0} Creating timer.\n",DateTime.Now.ToString("HH:mm:ss"));
statusChecker.statetime = DateTime.Now.ToString("HH:mm:ss"); TimerCallback callback = new TimerCallback(statusChecker.CheckCount);
Timer timer = new Timer(callback, autoEvent, 1000, 30000);
Timer stateTimer = new Timer(timerDelegate, autoEvent, 1000, 1000); Console.ReadLine();
}
哪个知道把这个线程能由用户控制停下,再由用户控制启动
{
static void Main()
{
AutoResetEvent autoEvent = new AutoResetEvent(false);
StatusChecker statusChecker = new StatusChecker();
TimerCallback timerDelegate =
new TimerCallback(statusChecker.CheckStatus); Console.WriteLine("{0} Creating timer.\n",DateTime.Now.ToString("HH:mm:ss"));
statusChecker.statetime = DateTime.Now.ToString("HH:mm:ss"); TimerCallback callback = new TimerCallback(statusChecker.CheckCount);
Timer timer = new Timer(callback, autoEvent, 1000, 30000);
Timer stateTimer = new Timer(timerDelegate, autoEvent, 1000, 1000); Console.ReadLine();
}
哪个知道把这个线程能由用户控制停下,再由用户控制启动
解决方案 »
- c#,在登陆界面输入帐号密码,进入主窗体,然后登陆界面关闭。该怎么做
- 怎样才能把主程序和引用的dll放于不同目录?
- Image.RotateFlip 方法 怎样实现图像 翻转后的 复位。
- (在线等待 + 满分)关于批量增加及更新的问题
- 在FTP 中如何判断一个目录还是文件?
- 我想在C#中调用VC开发的OCX控件,怎么编写该控件的方法和事件啊!!!
- 有一张BMP的图片,上面有一写文字,我有什么办法提取这写文字?
- 怎样用水晶报表做一页类似学生档案的页面?
- 一个在C#中处理xml的问题,高手解答,高分回报
- 200分求C#写的Com组件例子!(收到给分)
- 重写窗体出错,请高手解答,谢谢,100分,希望大家来好好的讨论一下.不多说了
- 简单的cookies问题
http://blog.csdn.net/chengking/archive/2005/11/30/540646.aspxmore:
http://blog.csdn.net/ChengKing/category/160892.aspx