摘 要: 通常我们使用异步完成许多计算型的耗时操作,取得应用程序运行所需要的部分数据,再将它们绑定在 UI中呈现,这个过程由于数据量偏大,窗体会出现“失去响应”的情况,而线程技术的使用可以方便的实现并发执 行,提升资源的利用率,提高程序处理效率,解除“假死”这种糟糕的体验。本文通过对C#多线程技术及委托方法的 介绍,分析研究了在WinForm窗体开发中解决假死状态的两种方法,给出实例及相关代码,并对这两种方法的特点进 行了总结。 |
关键词: 多线程;假死;委托;BackGroundWorker控件 |
中图分类号: TP311.11
文献标识码: A
|
|
Research on the Application of Multi-Threading in WinForm Development |
ZHOU Lan
|
( Xuzhou Finance and Economics Branch, Jiangsu Lianhe Technical Institute, Xuzhou 221008, China)
|
Abstract: Asynchronous manners are usually adopted to implement lots of time-consuming computing operation,in order to achieve the data required by the application and bind them to be presented in UI.Due to the great amount of data,the form often stops responding.The multi-thread technology can facilitate the implementation of concurrency,promote the resource utilization,improve processing efficiency,and avoid the terrible experience of "suspended animation".Based on the C# multi-thread technology and principal methods,the paper analyzes two solutions to the problems of suspended animation in the WinForm development,provides examples and related code,and summarizes the characteristics of two solutions. |
Keywords: multi-threading;suspended animation;commission;BackGroundWorker widget |