多线程 TeeChart 和媒体元素
我正在 WPF 中工作,使用媒体元素和 WPF TeeChart(由 Steema 提供)。这两者都是可见的并且同时更新 - 在视频播放时,图表将定期更新以显示与视频中当前位置相关的数据。
问题是 TeeChart 需要很长时间才能更新,这会阻塞视频,从而导致播放变得不稳定。
我已经尝试了一些多线程,试图找到解决方案,但到目前为止还没有运气。我无法决定视频或图表何时更新,事实上,我怀疑 WPF 的工作方式是任何 WPF 元素始终绘制在一起。
有人能想到我能做些什么来解决这个问题吗?目前,我能想到的就是用 Win32 等效项替换其中一个或两个元素,并适当地托管它,但由于多种原因,我将其作为最后的手段。
I am working in WPF, using a Media Element and a WPF TeeChart (by Steema). Both of these are visible and updating at the same time - whilst the video is playing, the graph will update at regular intervals to show data relevant to the current location in the video.
The problem is that the TeeChart takes a long time to update, which blocks the video thus causing the playback to become jerky.
I have experimented a little with multithreading to try to find a solution for this, but so far have had no luck. I cannot dictate when either the video or the chart updates, in fact I suspect WPF works in such a way that any WPF elements are always drawn together.
Can anybody think of anything I can do to resolve this issue? At the moment all I can think of is replacing one or both of these elements with a Win32 equivalent and hosting it appropriately, but for numerous reasons I am leaving this as a last resort.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
万一您仍未解决该问题或供将来参考,您可以按照“实时图表”文章中所述优化 TeeChart 的性能:
http://www.teechart.net/reference/articles/index.php
这是一篇 TeeChart VCL 文章,但其中大部分内容也适用于 TeeChart .NET
另请注意,.NET 的 TeeChart 不是线程安全的。您需要给图表足够的时间来绘制它自己。您可以使用 sleep 调用来完成此操作,以便图表绘制在给定时间内完成,或者使用具有 AutoRepaint 属性的异步绘制技术,例如:
Just in case you still haven't solved that issue or for future reference, you can optimize TeeChart's performance as described in the "Real-time Charting" article here:
http://www.teechart.net/reference/articles/index.php
This is a TeeChart VCL article but most of it also applies to TeeChart for .NET
Also notice that TeeChart for .NET is not thread safe. You need to give enough time to the chart to paint itself. You can either do this using a a sleep call so that the chart painting finishes in the given time or use asynchronous painting technique with AutoRepaint property, for example: