I have a storyboard that I reuse to animate some images, I want to perform some operation after each animation that involves some calculations, and then start another animation, so I believe I should use the completed StoryBoard event MyStoryboard.Completed += storyboard_Completed;
I am wondering if I should start the next animation in the current StoryBoard Storyboard_Completed Event ? And are there any consequences if I started the first animation in a separate thread using Object.Current.Dispatcher Object?
If I called StoryBoard.Begin () in a separate thread using Application.Current.Dispatcher, will the Storyboard_Completed event also be raised in the UI thread? In this case, do I still need to wrap the following animation in another dispatcher call?
private void Story_Completed(object sender, EventArgs e) { Application.Current.Dispatcher.Invoke((Action)delegate() { SomeNewStoryBoardAnimation.Begin(); } }
It is right? Or is there a better way to check if the storyboard is over and start the next set of calculations and animation of the storyboard right after that?
I was thinking about using one desktop background to handle all the animations and calculations in a sequence, but I'm also interested in how to “wait” for the animation to complete before starting the next set of calculations and animations. Is it OK for BackGroundWorker to have Thread.sleep while waiting for an animation?
wpf wpf-controls
black eyed pea
source share