private void StartPlaying() { // If already playing, keep playing till PlayAsync completes or is interrupted. if (Playback_Player.IsPlaying && PauseButton.IsChecked == false) { return; } // Resume playing the animation, if paused. if (PauseButton.IsChecked == true) { PauseButton.IsChecked = false; } else { // Play the animation at the currently specified playback rate. _ = Playback_Player.PlayAsync(fromProgress: 0, toProgress: 1, looped: false); } }
private void PauseButton_Unchecked(object sender, RoutedEventArgs e) { // Resume playing current animation. Playback_Player.Resume(); }
private void StopButton_Click(object sender, RoutedEventArgs e) { // Stop the animation, which completes PlayAsync and resets to initial frame. Playback_Player.Stop(); PauseButton.IsChecked = false; }
private void PauseButton_Checked(object sender, RoutedEventArgs e) { // Pause the animation, if playing. // NOTE: Pausing does not cause PlayAsync to complete. Playback_Player.Pause(); }