简体   繁体   English

实现多线程

[英]implement multithreading

how to to implement multithreading where one thread updating UI and other one is reading the database record in windows application 如何实现多线程处理,其中一个线程更新用户界面,另一线程正在读取Windows应用程序中的数据库记录

Any guidelines really appreciated... 任何指导方针都非常感谢...

you should look at the BackgroundWorker . 您应该查看BackgroundWorker

This will allow you to start the database operations on a background thread, so that your UI is not locked and also to report progress back to the main thread so you can update the UI with the results. 这将允许您在后台线程上启动数据库操作,这样您的UI不会被锁定,还可以将进度报告回主线程,以便您可以用结果更新UI。

You already have your UI thread running. 您已经在运行UI线程。 Hence create a thread/ BackgroundWorker for the db operation. 因此,为db操作创建线程/ BackgroundWorker

The backgroundworker has some convenient functions to do work without blocking the UI while it's possible to update the UI. 后台工作人员具有一些方便的功能,可以在不更新UI的情况下进行工作,同时可以更新UI。 MSDN MSDN

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM