Lousy.Mon.EventToken.PassOn C# (CSharp) Method

PassOn() public method

Passes on child animations to the specified successor. The current EventToken's child animations are activated by the successor's completion events. Used in conjunction with EventToken.PlaceHolderToken for creating animations out of order.
public PassOn ( EventToken successor ) : EventToken
successor EventToken
return EventToken
        public EventToken PassOn(EventToken successor)
        {
            // Unregister for the predecessor's completion events
            if (_Animation != null)
            {
                _Animation.Completed -= AnimationEventHandler;
            }

            // Hand off the children to the successor
            if (_Children != null)
            {
                foreach (IAnimator anim in _Children.Keys)
                {
                    successor.AddChildAnimator(anim, _Children[anim]);
                }

                _Children.Clear();
            }

            return successor;
        }

Usage Example

Example #1
0
        /// <summary>
        /// <para>Executes the user code after a specified duration.</para>
        /// <para>Note: This method produces a working EventToken</para>
        /// </summary>
        /// <param name="duration"></param>
        /// <param name="timeType"></param>
        /// <returns>A token representing the animation</returns>
        public override EventToken After(double duration, OrSo timeType)
        {
            DispatcherTimer timer       = new DispatcherTimer();
            EventToken      placeholder = EventToken.PlaceholderToken();

            timer.Interval = GetTimeSpan(duration, timeType);
            timer.Tick    += (s, e) =>
            {
                timer.Stop();
                placeholder.PassOn(Now());
            };
            timer.Start();

            return(placeholder);
        }
All Usage Examples Of Lousy.Mon.EventToken::PassOn