当其他线程开始执行某些工作时 Wpf 窗口冻结
WPF 中有什么东西可以在 WindowsForms 中执行“DoEvents”方法吗?
我问这个问题是因为我正在尝试在线程中使用 COM Interop,当它执行其工作时,ProgressBar 正在更新。
我找不到任何看起来很容易做到这一点的东西。
我没有太多的时间来阅读和实现一些疯狂的事情,我几乎要退出并让ProgressBar 的属性IsInminated 为True。
is there anything in WPF that do in WindowsForms the method "DoEvents"?
I am asking this because i am trying to use COM Interop in a thread, and when it is doing his job the ProgressBar is being updated.
I can't find anything that seems to be easy to do this.
I don't have too much time to be reading and implementing some crazy things, i am almost quitting and leaving the ProgressBar with the Property IsIndeterminate as True.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下示例向您展示如何在 UI 线程之外的另一个线程中执行某些操作。我对 COM 了解不多,因此我不能说它如何与 COM 调用结合起来,但对于 .net 端,这应该可以帮助您,而无需阅读太多内容。 在这里您可以找到文档。
虽然我不建议使用它,但这里有一个代码示例,它执行的操作与您从 DoEvents 中了解到的类似:
The following example shows you, how to execute some action in another thread than the UI-thread. I don't know a lot about COM, therefore I can not say how this combines with COM-calls, but for the .net-side, this should help you without reading a lot. Here you find the documentation.
Although I do not recommend to use it, here a code-example that does something like you know from DoEvents: