毕业论文

打赏
当前位置: 毕业论文 > 电子通信 >

Backgroundworker对象在多线程任务中的应用

时间:2019-08-25 09:16来源:毕业论文
创建一个 BackgroundWorker,侦听那些报告操作进度并在操作完成时发出信号的事件。若要为后台操作做好准备,则可添加 DoWork 事件的事件处理程序。 在此事件处理程序中调用耗时的操作

摘要:耗时的操作(如下载和数据库事务)在长时间运行时可能会导致用户界面 (UI) 似乎处于停止响应状态。这种耗时的操作,无论是I/O密集型操作,亦或是计算密集型操作,要做到最高效的使用系统资源,我们便可采取多线程操作,让这些运算在后台完成,完成后再给出提示。线程在后台运行的过程中,不妨碍用户操作主界面,必要时可以控制线程的操作。39072
如果需要能进行响应的用户界面,而且面临与这类操作相关的长时间延迟,则可以使用 BackgroundWorker 类方便地解决问题。BackgroundWorker 类可在单独的专用线程上运行操作。利用.net中的BackgroundWorker控件,打开一个新的线程,把耗时的操作放在线程中执行,这样可以在用户界面上进行其他操作。新建的线程可以使用thread类,实现多线程的操作。
简单的查阅相关资料后可以知道:创建一个 BackgroundWorker,侦听那些报告操作进度并在操作完成时发出信号的事件。若要为后台操作做好准备,则可添加 DoWork 事件的事件处理程序。 在此事件处理程序中调用耗时的操作。 若要收到进度更新的通知,对应处理 ProgressChanged 事件。 若要在操作完成时收到通知,对应处理 RunWorkerCompleted 事件。以上提到的事件是BackgroundWorker的三个重要事件……
本论文即旨在从Backgroundworker出发,深入了解学习异步模式的原理和使用方法。
毕业论文关键词:  并发执行;BackgroundWorker类;耗时的操作;异步
Application of Backgroundworker in multi-threaded task
Abstract:Time-consuming operations like downloads and database transactions can cause your user interface (UI) to seem as though it has stopped responding while they are running.This time-consuming operation, both I / O intensive operations, or calculation intensive operation, in order to achieve the most efficient use of system resources, we can take multi-threaded operation, so that these operations are done in the background. After the completion of the tips are given. The thread runs in the background, does not prevent the user to operate the main interface, when necessary, it can control the operation of the thread.
When you want a responsive UI and you are faced with long delays associated with such operations, the BackgroundWorker class provides a convenient solution. The BackgroundWorker class allows you to run an operation on a separate, dedicated thread.Using BackgroundWorker, opening a new thread, executiving the time-consuming operation into the thread, so that other users can perform other interfaces. The newly created thread can use the thread class to implement the multithreaded operation.
After a simple access to the relevant information can be aware that :To execute a time-consuming operation in the background, create a BackgroundWorker and listen for events that report the progress of your operation and signal when your operation is finished. To set up for a background operation, add an event handler for the DoWork event. Call your time-consuming operation in this event handler. To receive notifications of progress updates, handle the ProgressChanged event. To receive a notification when the operation is completed, handle the RunWorkerCompleted event.The events mentioned above are three important events for BackgroundWorker…
This thesis here is to learn more about the principle and the use of asynchronous mode thoroughly ,starting from the Backgroundworker.
Keywords: Concurrent execution ;The BackgroundWorker class ; Time-consuming operations ; Asynchronous
 目录
1    绪论    3
1.1    课题研究的目的    3
1.2    课题研究的意义    3
2    基础知识理解    3
2.1    前言    3 Backgroundworker对象在多线程任务中的应用:http://www.751com.cn/tongxin/lunwen_38188.html
------分隔线----------------------------
推荐内容