In my SL application I have a DispatchTimer which periodically refreshes data on the screen. I would like to create a visualisation for the user to show when the next refresh will happen.

My first thought was to change the timer (which currently runs every 20 seconds) to run every millisecond and, each tick, update a ProgressBar and count-down till the 20 seconds are up to run the main update method.

But I cannot shake the feeling that there's probably a better way of doing this. This feels quite heavy.

IS there a better way of doing this?

有帮助吗?

解决方案

I would make an animated progress bar which resets on reaching the end. Easiest would be to create two rectangles, one on top of antother with different colors. Animate width of the one on the top from 0 to length of your progress bar. You can control it by making a property which indicates how long should the animation last. And maybe some start method to synchronize with refresh actions.

EDIT. There is example on msdn HERE (examples section)

其他提示

The idea of a progres bar is not that bad. Updating every milisecond or each tick is much to often. 10 times a second would be enough.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top