WPF - 导航块应用程序(性能差)
我有一个生成 MIDI 音符(音序器)的 WPF 应用程序。
除了 UI 线程之外,还有一个触发笔记的计时器线程。一般来说,计时没问题,但我有以下问题:每当我进行任何导航时,应用程序似乎都会“阻塞”(即计时器“绊倒”并且输出会短暂停止)。例如,当我打开新窗口或在导航窗口上执行导航时,就会发生这种情况。
当我导航到已经实例化并且之前已经显示过的页面时,也会发生这种情况。
有人有什么想法吗?
编辑:我认为真正的问题是:有谁知道有一种方法可以使导航更快吗?
I have a WPF application which generates MIDI notes (a sequencer).
Besides the UI thread, there is a timer thread which triggers notes. In general, the timing is ok, but I have the following problem: Whenever I do any navigation, the application seems to "block" (i.e. the timer "stumbles" and the output stops for a short time). This happens when I e.g. open a new window or perform a navigation on a navigation window.
This also happens when I navigate to a page which is already instantiated and has been shown before.
Does anyone have any ideas?
EDIT: I think the actual question is: Does anyone know of a way to make navigation faster?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定,但是您的事件处理程序 (_midiInternalClock_Tick) 不会在您的 UI 线程中执行吗?
因此 MidiInternalClock 可能在另一个线程中执行,但滴答的处理不会。就像我说的,对此不确定。
您可能希望将与 Midi 工具包一起使用的代码分离到一个单独的类中,然后构造时钟并在不同的线程中处理它的事件。
如果这没有帮助,我就不知所措了。我想您最好在 CodeProject 页面上提出您的问题。
I'm not sure, but wouldn't your eventhandler (_midiInternalClock_Tick) be executed in your UI thread?
So the MidiInternalClock might be executing in another thread, but the handling of the ticks wouldn't. Like I said, not sure about this.
You might want to separate the code that works with the Midi toolkit to a separate class and then construct the clock en handle it's events in a different thread.
If that doesn't help, I'm at a loss. I guess you would then best ask your question on the CodeProject page.