在winforms中加载延迟 [英] Lazy Loading in winforms

查看:101
本文介绍了在winforms中加载延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个winform应用程序,我必须从Web服务获取数据并在UI中显示它。由于数据更多,我想要批量加载数据(即,在最初获取数据时,它应该只从DB中带来10条记录,下次从DB中接下来10条记录,依此类推......)。要求是每次我调用Web服务它应该只提供10条记录但不是全部,因此数据加载时间会少于数千条数据。



怎么做。



我可以在winform中实现延迟加载,如果是的话??? ???

I have a winform app where I have to get the data from web service and show it in UI. As the data is more I want to load the data batch wise(i.e when gets the data initially, it should bring only 10 records from DB and next time next 10 records from DB and so on...). The requirement is every-time I call the Web Service it should give only 10 records but not all, so that data loading time will be less as there are thousands of data.

How to do this.

Can I implement lazy loading in winform, if yes how???

推荐答案

是的。

我们可以告诉你具体如何做到这一点 - 我们不知道你的app是如何构建的 - 但它肯定是可能的。我使用一个应用程序,我必须加载大约6000个图像缩略图,所以我在后台执行该操作,而应用程序的其余部分正在运行。



有一个请查看 BackgroundWorker类 [ ^ ] - 它非常易于使用,并提供了一种相对简单的方法来进行离线漫长的操作。
Yes.
We can;t tell you exactly how to do this - we have no idea how you app is structured - but it's certainly possible. I do it with one app where I have to load about 6000 image thumbnails, so I do that in the background while the rest of the app is running.

Have a look at the BackgroundWorker class[^] - it's very easy to use and provides a relatively simple way to get into "off-lining" lengthy operations.


这篇关于在winforms中加载延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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