Reputation: 1180
I have the following code:
MediaPlayer.MoveNext();
SlideTransition slideTransition = new SlideTransition { Mode = SlideTransitionMode.SlideRightFadeOut };
ITransition transition = slideTransition.GetTransition(textBlockSong);
transition.Completed += delegate { transition.Stop(); };
transition.Begin();
//would like a pause here.
SlideTransition slideTransition2 = new SlideTransition { Mode = SlideTransitionMode.SlideRightFadeIn };
ITransition transition2 = slideTransition2.GetTransition(textBlockSong);
transition2.Completed += delegate { transition2.Stop(); };
transition2.Begin();
However the first transition doesn't get a chance to run as the second part kicks in immediately. So how can I add a pause/delay inbetween the two transitions, which doesn't completely halt the app (like Thread.Sleep()
) but just waits until the proceeding code is called?
Upvotes: 1
Views: 73
Reputation: 623
Use Thread.Sleep Method, it blocks the current thread for the specified number of milliseconds.
Upvotes: 0
Reputation: 22038
I'm not that familiar yet, but you can try to put your transition into storyboards. Storyboard have a Completed event.
Edit:
What about this?
SlideTransition slideTransition = new SlideTransition { Mode = SlideTransitionMode.SlideRightFadeOut };
ITransition transition = slideTransition.GetTransition(textBlockSong);
transition.Completed += delegate
{
transition.Stop();
SlideTransition slideTransition2 = new SlideTransition { Mode = SlideTransitionMode.SlideRightFadeIn };
ITransition transition2 = slideTransition2.GetTransition(textBlockSong);
transition2.Completed += delegate { transition2.Stop(); };
transition2.Begin();
};
transition.Begin();
Upvotes: 1