private void videoPlayer_MediaEnded(object sender, RoutedEventArgs e) { _isRecordingUserAction = true; DispatcherTimer timer = new DispatcherTimer(DispatcherPriority.Normal, Application.Current.Dispatcher); timer.Interval = new TimeSpan(0, 0, 3); timer.Tick += (object sender1, EventArgs e1) => { lblScore.Content = Convert.ToUInt32(lblScore.Content) + new Random().Next(10000); _isRecordingUserAction = false; PlayScreenImage.Visibility = PlayScreenImageVisibility; VideoScreen.Visibility = VideoScreenVisibility; timer.Stop(); if ((++repeatTime) < 3) { this.VideoScreen.Position = new TimeSpan(0, 0, 0); this.VideoScreen.Play(); } else { GameOverPage gameOverPage = new GameOverPage(); this.NavigationService.Navigate(gameOverPage); } }; timer.Start(); }