System.Threading.Timer定时器遍历问题
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
Model mod = new Model();
ThreadTimer_item = new System.Threading.Timer(new System.Threading.TimerCallback(caculate_item), mod, 0, itemcycle);
}
private void caculate_item(object o)
{
while (!this.IsHandleCreated)
{
;
}
this.Invoke(new OutputDelegate(ItemOnSale), o);
}
public void ItemOnSale(object state)
{
Mode.a model = (Model.a)state;
获取model进行计算...
}
第二次开始定时器只能执行最后一个mod
怎么样才能够实现定时执行for循环中的所有mod