/// <summary> /// Clears the active animations. /// </summary> /// <param name="animationItem">The animation item.</param> protected void ClearActiveAnimations(AnimationItem animationItem) { foreach (var activeAnimation in this.activeAnimations.ToArray()) { if (activeAnimation.Element.Equals(animationItem.Element)) { this.activeAnimations.Remove(activeAnimation); } } }
/// <summary> /// Handles the animation event. /// </summary> /// <param name="animationItem">The animation item.</param> protected void HandleAnimationEvent(AnimationItem animationItem) { foreach (var a in this.activeAnimations.ToArray()) { if (a.Element.Equals(animationItem.Element)) { this.activeAnimations.Remove(a); } } this.activeAnimations.Add(animationItem); animationItem.Animation.Completed += delegate { this.activeAnimations.Remove(animationItem); if (!this.activeAnimations.Any()) { this.OnCompleted?.Invoke(null, EventArgs.Empty); } }; }