in src/Microsoft.Xaml.Behaviors/Media/StoryboardAction.cs [82:129]
protected override void Invoke(object parameter)
{
if (this.AssociatedObject != null && this.Storyboard != null)
{
switch (this.ControlStoryboardOption)
{
case ControlStoryboardOption.Play:
this.Storyboard.Begin();
break;
case ControlStoryboardOption.Stop:
this.Storyboard.Stop();
break;
case ControlStoryboardOption.TogglePlayPause:
ClockState clockState = ClockState.Stopped;
bool isPaused = false;
try
{
clockState = this.Storyboard.GetCurrentState();
isPaused = this.Storyboard.GetIsPaused();
}
catch (InvalidOperationException)
{
}
if (clockState == ClockState.Stopped)
{
this.Storyboard.Begin();
}
else if (isPaused)
{
this.Storyboard.Resume();
}
else
{
this.Storyboard.Pause();
}
break;
case ControlStoryboardOption.Pause:
this.Storyboard.Pause();
break;
case ControlStoryboardOption.Resume:
this.Storyboard.Resume();
break;
case ControlStoryboardOption.SkipToFill:
this.Storyboard.SkipToFill();
break;
}
}
}