后台工人问题 [英] Backround Worker Issue

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

问题描述


对不起,我想重新发布.已经发布了同一期.是WPF的新功能.
我们正在开发下载管理器.当网络断开时会自动找到下载管理器.然后暂时暂停.然后建立连接后将下载. (网络检测方法位于计时器内部,因此它将每秒检查一次.)
互联网连接打开后,暂停和恢复功能就可以正常工作了.
我的问题是

1)首先我尝试下载时进行网络检测方法检查.然后它在网络断开期间检测到net.so,我的backround worker线程停止了.所以在那之后我无法恢复.
2)然后我使用了另一种方法.在UI中发生进度受限事件期间.我正在检查网络检测方法.当我在此方法中使用时,由于每次检查网络时进度更改过程均不起作用.由于这个原因,我离开了.

3)第三种方法,断开互联网后我使用了文件层写程序.它也无法正常工作.

Hi,
Sorry For Repost.Already Posted Same issue.Am new to WPF.
We have developing Download manager.When net disconnect automatically found download manager.Then Pause it temporarily.Then After get connection It will download Will process.the above Same Procedure used in system shutdown too.
(net detect method is placed inside the timer.so it will check every second.)
Then Pause and resume is working properly when internet connection is on.
My Issue is

1)First i tried net detect method checking while downloading.Then it detected net.so during net disconnect my backround worker thread stoped.so i cannot make Resume After That.

2)Then i used another method.during progress cahnged event in UI.I am checking net detect method.when i used in this method progress changing process is not working ..because every time it checked the net. due to that i leaved that.

3)Third method ,I used file straem writer after disconnect internet.it s also not working properly.

推荐答案

.NET 4.0具有内置的并行扩展名,该扩展名需要应对并行处理挑战.你可以试试看.

.NET 4.0 has the built-in parallel extension which takes care of the parallel processing challenges. You can try that.

IEnumerable<Int32> items = Enumerable.Range(0,20);

Parallel.ForEach(items,
    (item) => ProcessLoop(item));




在网络中检查Parallel.For或Parallel.Foreach.




Check for Parallel.For or Parallel.Foreach in the web.


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

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