Example #1
0
        /// <summary>
        /// Helper used by the four Freezable clone methods to copy the resolved key times and
        /// key frames. The Get*AsFrozenCore methods are implemented the same as the Clone*Core
        /// methods; Get*AsFrozen at the top level will recursively Freeze so it's not done here.
        /// </summary>
        /// <param name="sourceAnimation"></param>
        /// <param name="isCurrentValueClone"></param>
        private void CopyCommon(ThicknessAnimationUsingKeyFrames sourceAnimation, bool isCurrentValueClone)
        {
            _areKeyTimesValid = sourceAnimation._areKeyTimesValid;

            if (_areKeyTimesValid &&
                sourceAnimation._sortedResolvedKeyFrames != null)
            {
                // _sortedResolvedKeyFrames is an array of ResolvedKeyFrameEntry so the notion of CurrentValueClone doesn't apply
                _sortedResolvedKeyFrames = (ResolvedKeyFrameEntry[])sourceAnimation._sortedResolvedKeyFrames.Clone();
            }

            if (sourceAnimation._keyFrames != null)
            {
                if (isCurrentValueClone)
                {
                    _keyFrames = (ThicknessKeyFrameCollection)sourceAnimation._keyFrames.CloneCurrentValue();
                }
                else
                {
                    _keyFrames = (ThicknessKeyFrameCollection)sourceAnimation._keyFrames.Clone();
                }

                OnFreezablePropertyChanged(null, _keyFrames);
            }
        }
        /// <summary>Makes this instance a clone of the specified <see cref="T:System.Windows.Media.Animation.ThicknessKeyFrameCollection" /> object. </summary>
        /// <param name="sourceFreezable">The <see cref="T:System.Windows.Media.Animation.ThicknessKeyFrameCollection" /> object to clone.</param>
        // Token: 0x0600177D RID: 6013 RVA: 0x000730F4 File Offset: 0x000712F4
        protected override void GetAsFrozenCore(Freezable sourceFreezable)
        {
            ThicknessKeyFrameCollection thicknessKeyFrameCollection = (ThicknessKeyFrameCollection)sourceFreezable;

            base.GetAsFrozenCore(sourceFreezable);
            int count = thicknessKeyFrameCollection._keyFrames.Count;

            this._keyFrames = new List <ThicknessKeyFrame>(count);
            for (int i = 0; i < count; i++)
            {
                ThicknessKeyFrame thicknessKeyFrame = (ThicknessKeyFrame)thicknessKeyFrameCollection._keyFrames[i].GetAsFrozen();
                this._keyFrames.Add(thicknessKeyFrame);
                base.OnFreezablePropertyChanged(null, thicknessKeyFrame);
            }
        }
        /// <summary>
        /// Implementation of <see cref="System.Windows.Freezable.CloneCore(System.Windows.Freezable)">Freezable.CloneCore</see>.
        /// </summary>
        protected override void CloneCore(Freezable sourceFreezable)
        {
            ThicknessKeyFrameCollection sourceCollection = (ThicknessKeyFrameCollection)sourceFreezable;

            base.CloneCore(sourceFreezable);

            int count = sourceCollection._keyFrames.Count;

            _keyFrames = new List <ThicknessKeyFrame>(count);

            for (int i = 0; i < count; i++)
            {
                ThicknessKeyFrame keyFrame = (ThicknessKeyFrame)sourceCollection._keyFrames[i].Clone();
                _keyFrames.Add(keyFrame);
                OnFreezablePropertyChanged(null, keyFrame);
            }
        }
        /// <summary>
        /// Helper used by the four Freezable clone methods to copy the resolved key times and 
        /// key frames. The Get*AsFrozenCore methods are implemented the same as the Clone*Core
        /// methods; Get*AsFrozen at the top level will recursively Freeze so it's not done here.
        /// </summary>
        /// <param name="sourceAnimation"></param>
        /// <param name="isCurrentValueClone"></param>
        private void CopyCommon(ThicknessAnimationUsingKeyFrames sourceAnimation, bool isCurrentValueClone)
        {    
            _areKeyTimesValid = sourceAnimation._areKeyTimesValid;

            if (   _areKeyTimesValid 
                && sourceAnimation._sortedResolvedKeyFrames != null)
            {
                // _sortedResolvedKeyFrames is an array of ResolvedKeyFrameEntry so the notion of CurrentValueClone doesn't apply
                _sortedResolvedKeyFrames = (ResolvedKeyFrameEntry[])sourceAnimation._sortedResolvedKeyFrames.Clone(); 
            }

            if (sourceAnimation._keyFrames != null)
            {
                if (isCurrentValueClone)
                {
                    _keyFrames = (ThicknessKeyFrameCollection)sourceAnimation._keyFrames.CloneCurrentValue();
                }
                else
                {
                    _keyFrames = (ThicknessKeyFrameCollection)sourceAnimation._keyFrames.Clone();
                }

                OnFreezablePropertyChanged(null, _keyFrames);
            }
        }