【发布时间】:2009-10-08 20:36:12
【问题描述】:
我有一个方法,正在第二个线程中调用:
public byte[] ReadAllBytesFromStream(Stream input)
{
clock.Start();
using (...)
{
while (some conditions) //here we read all bytes from a stream (FTP)
{
...
(int-->) ByteCount = aValue;
...
}
return .... ;
}
}
private void clock_Tick(object sender, EventArgs e)
{
//show how many bytes we have read in each second
this.label6.Text = ByteCount.ToString() + " B/s";
}
问题是,时钟已启用,但它没有滴答作响。为什么?
更新:
Tick 事件已正确添加,Interval 属性设置为 1000。
我将计时器控件放在设计视图中的表单上。
【问题讨论】:
-
我刚刚在设计视图中的窗体上放置了定时器控件
-
正确添加Tick事件,Interval属性设置为1000
标签: c# multithreading timer