Exemple #1
0
        /// <summary>
        /// Dumps the description of the subtree rooted at this timeline.
        /// </summary>
        /// <param name="builder">
        /// A StringBuilder that accumulates the description text.
        /// </param>
        /// <param name="depth">
        /// The depth of recursion for this timeline.
        /// </param>
        internal void BuildInfoRecursive(System.Text.StringBuilder builder, int depth)
        {
            // Add the info for this timeline
            BuildInfo(builder, depth, true);

            // Recurse into the children
            depth++;
            TimelineGroup timelineGroup = this as TimelineGroup;

            if (timelineGroup != null)
            {
                TimelineCollection children = timelineGroup.Children;
                if (children != null)
                {
                    for (int childIndex = 0; childIndex < children.Count; childIndex++)
                    {
                        children.Internal_GetItem(childIndex).BuildInfoRecursive(builder, depth);
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Advances the enumerator to the next element of the collection.
        /// </summary>
        /// <returns>
        /// true if the enumerator was successfully advanced to the next element,
        /// false if the enumerator has passed the end of the collection.
        /// </returns>
        public bool MoveNext()
        {
            TimelineCollection children;

            // Get the iteration started in the right place, if we are just starting
            if ((_flags & SubtreeFlag.Reset) != 0)
            {
                // The reset flag takes effect only once
                _flags &= ~SubtreeFlag.Reset;

                // We are just getting started. The first timeline is the root
                _timelineStack.Push(_rootTimeline);

                // If we are not supposed to return the root, simply skip it
                if ((_flags & SubtreeFlag.ProcessRoot) == 0)
                {
                    MoveNext();
                }
            }
            else if (_timelineStack.Count > 0)
            {
                // Only TimelineGroup can have children
                TimelineGroup timelineGroup = _timelineStack.Peek() as TimelineGroup;

                // The next timeline is possibly the first child of the current timeline
                // If we have children move to the first one, unless we were
                // asked to skip the subtree
                if (((_flags & SubtreeFlag.SkipSubtree) == 0) &&
                    timelineGroup != null &&
                    (children = timelineGroup.Children) != null &&
                    children.Count > 0
                    )
                {
                    _timelineStack.Push(children[0]);
                    _indexStack.Push((int)0);
                }
                else
                {
                    // The skip subtree flag takes effect only once
                    _flags &= ~SubtreeFlag.SkipSubtree;

                    // Move to the first ancestor that has unvisited children,
                    // then move to the first unvisited child. If we get to
                    // the root it means we are done.
                    _timelineStack.Pop();
                    while (_timelineStack.Count > 0)
                    {
                        timelineGroup = _timelineStack.Peek() as TimelineGroup;

                        // This has to be non-null since we already went down the tree
                        children = timelineGroup.Children;

                        int index = (int)_indexStack.Pop() + 1;

                        if (index < children.Count)
                        {
                            // Move to the next child, and we are done
                            _timelineStack.Push(children[index]);
                            _indexStack.Push(index);
                            break;
                        }

                        _timelineStack.Pop();
                    }
                }
            }

            return(_timelineStack.Count > 0);
        }
Exemple #3
0
        internal override void BuildClockSubTreeFromTimeline(
            Timeline timeline,
            bool hasControllableRoot)
        {
            // This is not currently necessary
            //base.BuildClockSubTreeFromTimeline(timeline);

            // Only TimelineGroup has children
            TimelineGroup timelineGroup = timeline as TimelineGroup;

            // Only a TimelineGroup should have allocated a ClockGroup.
            Debug.Assert(timelineGroup != null);

            // Create a clock for each of the children of the timeline
            TimelineCollection timelineChildren = timelineGroup.Children;

            if (timelineChildren != null && timelineChildren.Count > 0)
            {
                Clock childClock;

                // Create a collection for the children of the clock
                _children = new List <Clock>();

                // Create clocks for the children
                for (int index = 0; index < timelineChildren.Count; index++)
                {
                    childClock         = AllocateClock(timelineChildren[index], hasControllableRoot);
                    childClock._parent = this;  // We connect the child to the subtree before calling BuildClockSubtreeFromTimeline
                    childClock.BuildClockSubTreeFromTimeline(timelineChildren[index], hasControllableRoot);
                    _children.Add(childClock);
                    childClock._childIndex = index;
                }

                // If we have SlipBehavior, check if we have any childen with which to slip.
                if (_timeline is ParallelTimeline &&
                    ((ParallelTimeline)_timeline).SlipBehavior == SlipBehavior.Slip)
                {
                    // Verify that we only use SlipBehavior in supported scenarios
                    if (!IsRoot ||
                        (_timeline.RepeatBehavior.HasDuration) ||
                        (_timeline.AutoReverse == true) ||
                        (_timeline.AccelerationRatio > 0) ||
                        (_timeline.DecelerationRatio > 0))
                    {
                        throw new NotSupportedException(SR.Get(SRID.Timing_SlipBehavior_SlipOnlyOnSimpleTimelines));
                    }

                    for (int index = 0; index < _children.Count; index++)
                    {
                        Clock child = _children[index];
                        if (child.CanSlip)
                        {
                            Duration duration = child.ResolvedDuration;

                            // A sync clock with duration of zero or no begin time has no effect, so do skip it
                            if ((!duration.HasTimeSpan || duration.TimeSpan > TimeSpan.Zero) &&
                                child._timeline.BeginTime.HasValue)
                            {
                                _syncData       = new SyncData(child);
                                child._syncData = null;  // The child will no longer self-sync
                            }

                            break;  // We only want the first child with CanSlip
                        }
                    }
                }
            }
        }
Exemple #4
0
 /// <summary>
 /// Creates a new empty ClockGroup to be used in a Clock tree.
 /// </summary>
 /// <param name="timelineGroup">The TimelineGroup used to define the new
 /// ClockGroup.</param>
 protected internal ClockGroup(TimelineGroup timelineGroup)
     : base(timelineGroup)
 {
 }
 public TimelineGroupClock(IClock baseGroupClock, TimelineGroup timelineGroup, IEnumerable <TimelineClock> children) :
     base(baseGroupClock, timelineGroup)
 {
     this.Children = children;
 }
 /// <summary>
 /// Creates a new empty ClockGroup to be used in a Clock tree.
 /// </summary>
 /// <param name="timelineGroup">The TimelineGroup used to define the new
 /// ClockGroup.</param>
 protected internal ClockGroup(TimelineGroup timelineGroup)
     : base(timelineGroup)
 {
 }
 protected internal ClockGroup(TimelineGroup timelineGroup) : base (default(Timeline))
 {
 }
 public TimelineGroupClock(IClock baseGroupClock, TimelineGroup timelineGroup, IEnumerable<TimelineClock> children)
     : base(baseGroupClock, timelineGroup)
 {
     this.Children = children;
 }
Exemple #9
0
 protected internal ClockGroup(TimelineGroup timelineGroup) : base(default(Timeline))
 {
 }