如何在 WPF 中显示数据库操作的进度条?

发布于 2024-08-29 23:17:29 字数 123 浏览 3 评论 0原文

我想向我的应用程序用户显示以下操作的进度条:

  1. 当他们在 WPF 中提供登录信息并点击“提交/确定”时。
  2. 当他们从数据库请求任何信息时(选择命令执行)。

谢谢

I want to show my application user a progressbar for following actions:

  1. when they provide login information in WPF and hit submit/OK whatever.
  2. when they request any information from DB (select command execution).

Thank You

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小伙你站住 2024-09-05 23:17:29

登录数据库是一个原子操作。所以你不能真正显示进度条。您可以显示等待指示器(沙漏),或不确定的进度条 > (实际上只是一个看起来像进度条的等待指示器)。

对于获取数据的查询,您可以通过对结果集进行分页来显示进度。根据您使用的数据库/ORM,有多种方法可以执行此操作。总体原理是设置一个工作线程,一次抓取一页数据。抓取页面后,将上下文切换到 UI 线程并更新屏幕以显示抓取的数据量。

A login to the database is an atomic operation. So you can't really show a progress bar. You can show a waiting indicator (hour glass), or an indeterminate progress bar (which is really just a waiting indicator that looks like a progress bar).

For a query that gets data, you can show progress by paging the result set. There are multiple ways to do this depending on the database/ORM you use. The general principle is to set up a worker thread and grab data one page at a time. After you grab a page, switch context to the UI thread and update the screen to show how much data you grabbed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文