关于后台工作人员控制 [英] regarding background worker control

查看:70
本文介绍了关于后台工作人员控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用后台工作人员...我希望每隔5分钟它会弹出一个消息窗口,需要紧急帮助

i m using a background worker ... i want after every 5 minutes it should pop up a messege need urgent help

推荐答案

我也不会碰后台工作人员并使用调度计时器.
请参阅 http://msdn.microsoft.com/en-us/library/system .windows.threading.dispatchertimer.aspx [ ^ ]
backgroundworker的问题在于它在不同的线程上,并且您不能在与GUI线程不同的线程上更改GUI元素,除非您使用reportsprogress功能.此外,后台工作人员不会跟踪时间.因此,只需在后台工作人员启动时创建一个调度计时器,并在后台工作人员完成后将其删除即可.
I would not touch the backgroundworker too much and use a dispatchtimer.
See http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatchertimer.aspx[^]
The problem with the backgroundworker is that it is on a different thread, and you cannot change GUI elements on a different thread than the GUI thread, except if you use the reportsprogress functionality. Moreover the backgroundworker does not track time. So just create a dispatchtimer when the backgroundworker starts, and remove it when the backgroundworker is done.


这篇关于关于后台工作人员控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆