private static object GetValueFromTimeline()

in src/Microsoft.Xaml.Behaviors/Core/ExtendedVisualStateManager.cs [1117:1182]


        private static object GetValueFromTimeline(Timeline timeline, out bool gotValue)
        {
            ObjectAnimationUsingKeyFrames objectAnimationUsingKeyFrames = timeline as ObjectAnimationUsingKeyFrames;
            if (objectAnimationUsingKeyFrames != null)
            {
                gotValue = true;
                return objectAnimationUsingKeyFrames.KeyFrames[0].Value;
            }
            else
            {
                DoubleAnimationUsingKeyFrames doubleAnimationUsingKeyFrames = timeline as DoubleAnimationUsingKeyFrames;
                if (doubleAnimationUsingKeyFrames != null)
                {
                    gotValue = true;
                    return doubleAnimationUsingKeyFrames.KeyFrames[0].Value;
                }
                else
                {
                    DoubleAnimation doubleAnimation = timeline as DoubleAnimation;
                    if (doubleAnimation != null)
                    {
                        gotValue = true;
                        return doubleAnimation.To;
                    }
                    else
                    {
                        ThicknessAnimationUsingKeyFrames thicknessAnimationUsingKeyFrames = timeline as ThicknessAnimationUsingKeyFrames;
                        if (thicknessAnimationUsingKeyFrames != null)
                        {
                            gotValue = true;
                            return thicknessAnimationUsingKeyFrames.KeyFrames[0].Value;
                        }
                        else
                        {
                            ThicknessAnimation thicknessAnimation = timeline as ThicknessAnimation;
                            if (thicknessAnimation != null)
                            {
                                gotValue = true;
                                return thicknessAnimation.To;
                            }
                            else
                            {
                                Int32AnimationUsingKeyFrames int32AnimationUsingKeyFrames = timeline as Int32AnimationUsingKeyFrames;
                                if (int32AnimationUsingKeyFrames != null)
                                {
                                    gotValue = true;
                                    return int32AnimationUsingKeyFrames.KeyFrames[0].Value;
                                }
                                else
                                {
                                    Int32Animation int32Animation = timeline as Int32Animation;
                                    if (int32Animation != null)
                                    {
                                        gotValue = true;
                                        return int32Animation.To;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            gotValue = false;
            return null;
        }