如何停止Download(Backgroundworker),然后单击按钮继续进行下载? [英] How to stop a Download( Backgroundworker) and then let it continue with clicking a Button ?

查看:115
本文介绍了如何停止Download(Backgroundworker),然后单击按钮继续进行下载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想知道如何停止在Background(Background worker´)中运行的下载,然后单击按钮^ ]由Carmine_XX编写.

请输入vb08的代码.

希望您能帮帮我.

[您提到的文章的添加到编辑的链接]

Hello Guys,

I want to know how to stop a download running in the Background(Background worker´) and then resume with clicking on a Button, the Download Manager[^] is written by Carmine_XX.

Code for vb08, please.

I hope you can help me.

推荐答案

看看这个线程.

http://social.msdn.microsoft.com/论坛/en-US/winforms/thread/52dcb460-90a3-45f2-ae23-bcb60514c542 [ CancelAsync 方法取消了后台工作程序.但是,辅助线程在每次更新UI线程时都会保存状态信息.这将工作进程状态"存储在主线程上.每当后台工作程序启动时,它都会简单地从状态变量中读取其信息并开始工作.

希望这对您有帮助... :)

茉莉(Jasmin)
Have a look at this thread.

http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/52dcb460-90a3-45f2-ae23-bcb60514c542[^]

The above works by saving the state information of the operation each time through its loop. When the user selects "Pause", the background worker is actually cancelled using CancelAsync method. However, the worker thread saves state information every time it updates the UI thread. This stores the "worker process state" on the main thread. Whenever the background worker is started, it simply reads its information from the state variable and goes to work.

Hope this helps... :)

Jasmin


这篇关于如何停止Download(Backgroundworker),然后单击按钮继续进行下载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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