Esempio n. 1
0
 public bool Equals(DependencyCombo other)
 {
     if (this.dObject == other.dObject &&
         this.dProperty == other.dProperty)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
        private static AnimationClock AnimateElementHelper(DependencyObject element, DependencyProperty property, AnimationTimeline anim)
        {
            if (!(element is IAnimatable))
            {
                throw new InvalidOperationException("Element must be IAnimatable.");
            }

            anim.FillBehavior = FillBehavior.HoldEnd;

            anim.Completed += new EventHandler(anim_Completed);

            anim.AccelerationRatio = .15;
            anim.DecelerationRatio = .85;

            AnimationClock  clock = anim.CreateClock();
            DependencyCombo dc    = new DependencyCombo(element, property);

            IAnimatable animatable = (IAnimatable)dc.DObject;

            animatable.ApplyAnimationClock(dc.DProperty, null);
            animatable.ApplyAnimationClock(dc.DProperty, clock);

            if (RunningAnimation.Values.Contains(dc))
            {
                List <AnimationClock> toDelete = new List <AnimationClock>();

                foreach (KeyValuePair <AnimationClock, DependencyCombo> kvp in RunningAnimation)
                {
                    if (kvp.Value.Equals(dc))
                    {
                        toDelete.Add(kvp.Key);
                        kvp.Key.Controller.Stop();
                    }
                }

                foreach (AnimationClock key in toDelete)
                {
                    RunningAnimation.Remove(key);
                }
            }

            RunningAnimation.Add(clock, dc);

            return(clock);
        }
Esempio n. 3
0
        private static void delayTimer_Tick(object sender, EventArgs e)
        {
            DispatcherTimer timer = sender as DispatcherTimer;

            if (timer != null)
            {
                AnimationData data;
                if (SavedAnimations.TryGetValue(timer, out data))
                {
                    SavedAnimations.Remove(timer);
                    timer.Stop();
                    timer.Tick -= delayTimer_Tick;

                    AnimationClock  clock = data.Clock;
                    DependencyCombo dc    = data.DependencyCombo;

                    IAnimatable animatable = (IAnimatable)dc.DObject;
                    animatable.ApplyAnimationClock(dc.DProperty, null);
                    animatable.ApplyAnimationClock(dc.DProperty, clock);

                    clock.Controller.Begin();

                    if (RunningAnimation.Values.Contains(dc))
                    {
                        List <AnimationClock> toDelete = new List <AnimationClock>();

                        foreach (KeyValuePair <AnimationClock, DependencyCombo> kvp in RunningAnimation)
                        {
                            if (kvp.Value.Equals(dc))
                            {
                                toDelete.Add(kvp.Key);
                                kvp.Key.Controller.Stop();
                            }
                        }

                        foreach (AnimationClock key in toDelete)
                        {
                            RunningAnimation.Remove(key);
                        }
                    }

                    RunningAnimation.Add(clock, dc);
                }
            }
        }
Esempio n. 4
0
 public AnimationData(AnimationClock clock, DependencyCombo dependencyCombo)
 {
     this.clock           = clock;
     this.dependencyCombo = dependencyCombo;
 }