Esempio n. 1
0
        public static RuntimeSetterTransition RunTransition(RuntimeSetter setter, object from, object to)
        {
            var type = from?.GetType() ?? to?.GetType();

            if (type == null)
            {
                return(null);
            }

            var pool = TransitionPools.GetValueOrDefault(type);

            if (pool == null)
            {
                var animatorFactory = AnimatorFactoryProvider.GetAnimatorFactory(type);

                if (animatorFactory == null)
                {
                    return(null);
                }

                TransitionPools[type] = pool = new RuntimeTransitionPool(animatorFactory);
            }

            var runtimeTransition = pool.GeTransition();

            runtimeTransition.ValueStore = setter.ActualValueStore;
            runtimeTransition.Start(setter, from, to);

            return(runtimeTransition);
        }
Esempio n. 2
0
        public override void Attach(RuntimeSetter setter)
        {
            _target.GetDependencyPropertyService().AddExpandoPropertyListener(_property, this);
            _value = _target.GetValue(_property);

            _runtimeSetter = setter;
        }
Esempio n. 3
0
        public void Start(RuntimeSetter setter, object from, object to)
        {
            var transition = setter.Transition;

            _animator.Start          = from;
            _animator.End            = to;
            _animator.EasingFunction = transition.EasingFunction;
            _animator.RelativeTime   = 0;

            var doubleAnimation = (DoubleAnimation)_storyboard.Children[0];

            doubleAnimation.BeginTime = transition.BeginTime;
            doubleAnimation.Duration  = transition.Duration;

            _storyboard.Begin();

            _setter = setter;
        }
Esempio n. 4
0
        private void OnCompleted(bool timeLineFinished)
        {
            if (_setter == null)
            {
                return;
            }

            if (timeLineFinished)
            {
                _animator.RelativeTime = 1.0;
            }

            var setter = _setter;

            _setter = null;

            setter.OnTransitionCompleted();

#if SILVERLIGHT
            setter.EffectiveValue.Target.Dispatcher.BeginInvoke(_releaseAction);
#else
            setter.EffectiveValue.Target.Dispatcher.BeginInvoke(_releaseAction, DispatcherPriority.Background);
#endif
        }
Esempio n. 5
0
 protected override object ProvideValueCore(RuntimeSetter setter)
 {
     return(_value);
 }
Esempio n. 6
0
 public override void Detach(RuntimeSetter setter)
 {
     _target.GetDependencyPropertyService().RemoveExpandoListener(_property, this);
     _runtimeSetter = null;
 }
Esempio n. 7
0
 protected abstract object ProvideValueCore(RuntimeSetter setter);
Esempio n. 8
0
 public sealed override object ProvideValue(RuntimeSetter setter)
 {
     return(_cache.ProvideValue(ProvideValueCore(setter), setter.EffectiveValue.Property.GetPropertyType()));
 }
Esempio n. 9
0
 public abstract object ProvideValue(RuntimeSetter setter);
Esempio n. 10
0
 public virtual void Detach(RuntimeSetter setter)
 {
 }