开发者

WP7 updating UI dynamically without blocking thread

开发者 https://www.devze.com 2023-02-25 20:31 出处:网络
I am making sort of a karaoke app, where I need to tie in timestamped text-data with audio data. I have 2 lists to indicate start and end of audio timespans and text string indices. The issue that I a

I am making sort of a karaoke app, where I need to tie in timestamped text-data with audio data. I have 2 lists to indicate start and end of audio timespans and text string indices. The issue that I am facing is I don't开发者_StackOverflow know how to update the highlighted text based on current media element's POSITION property.

WP7 doesn't have the Marker reached event ( which silverlight has ). So I was considering use of a DispatcherTimer. the issue with this is that the ticks that I want are non-uniform, and if I update the interval property every tick, the accuracy of the timer will fall greatly, as the media element's position and timer's tick will fall out of sync pretty easily.

Any idea how I get create my event similar to MarkerReached event of the Media element ? Thank you-Egon


I presume you have some form of data structure that tells you where the markers are in the audio stream, so why not use a DispatcherTimer with a fixed Interval (say 500 milliseconds) and simply check against this data structure to see if you've reached a marker?

0

精彩评论

暂无评论...
验证码 换一张
取 消