Esempio n. 1
0
        public bool RemoveAnimation([NotNull] AnimationWrapper animation)
        {
            if (animation == null)
            {
                throw new ArgumentNullException(nameof(animation));
            }

            return(RemoveAnimation(animation.Name));
        }
Esempio n. 2
0
        public bool AddAnimation([NotNull] AnimationWrapper animation)
        {
            if (animation == null)
            {
                throw new ArgumentNullException(nameof(animation));
            }

            if (_animationCache.ContainsKey(animation.Name))
            {
                return(false);
            }
            _animationCache.Add(animation.Name, animation);
            return(true);
        }
Esempio n. 3
0
        private void BeginAnimationImpl(
            AnimationWrapper animationWrapper,
            UIElement element,
            Action <AnimationTimeline> modifiers = null)
        {
            var animation = _animationObjectPoolers[animationWrapper.Name].GetObject();

            modifiers?.Invoke(animation);
            if (animationWrapper.OnCompleted != null)
            {
                var kvp = new KeyValuePair <UIElement, AnimationWrapper>(element, animationWrapper);
                if (_elementToAnimationCache.Add(kvp))
                {
                    animation.Completed += (sender, args) => animationWrapper.OnCompleted(sender, args, element);
                }
            }
            element.BeginAnimation(animationWrapper.TargetProperty, animation);
        }