Beispiel #1
0
        public override int CompareTo(TimelineItem timelineItem)
        {
            BehaviorTimelineItem behaviorTimelineItem = timelineItem as BehaviorTimelineItem;
            ElementTimelineItem  elementTimelineItem  = this.Parent as ElementTimelineItem;

            if (timelineItem is EffectTimelineItem)
            {
                return(1);
            }
            if (behaviorTimelineItem == null || elementTimelineItem == null)
            {
                return(0);
            }
            DocumentNode documentNode1 = this.ActionNode.DocumentNode;
            DocumentNode documentNode2 = behaviorTimelineItem.ActionNode.DocumentNode;
            bool         flag1         = documentNode1.Parent != null;
            bool         flag2         = documentNode2.Parent != null;

            if (flag1 && !flag2)
            {
                return(1);
            }
            if (!flag1 && flag2)
            {
                return(-1);
            }
            if (!flag1 && !flag2)
            {
                return(0);
            }
            if (documentNode1.Parent == documentNode2.Parent)
            {
                return(documentNode1.Parent.Children.IndexOf(documentNode1) - documentNode1.Parent.Children.IndexOf(documentNode2));
            }
            DocumentNode documentNode3 = (DocumentNode)documentNode1.Parent.Parent;
            DocumentNode documentNode4 = (DocumentNode)documentNode2.Parent.Parent;

            if (documentNode3.Parent == documentNode4.Parent)
            {
                return(documentNode3.Parent.Children.IndexOf(documentNode3) - documentNode4.Parent.Children.IndexOf(documentNode4));
            }
            int num1 = 0;

            for (SceneNode sceneNode = (SceneNode)this.ActionNode; sceneNode != null && !(sceneNode is SceneElement); sceneNode = sceneNode.Parent)
            {
                ++num1;
            }
            SceneNode sceneNode1 = (SceneNode)behaviorTimelineItem.ActionNode;
            int       num2       = 0;

            for (; sceneNode1 != null && !(sceneNode1 is SceneElement); sceneNode1 = sceneNode1.Parent)
            {
                ++num2;
            }
            return(num1 - num2);
        }
 public static ScheduledTimelineItem FindItem(TimelineItem parentTimelineItem, StoryboardTimelineSceneNode parentTimeline, PropertyReference targetProperty)
 {
     if (targetProperty == null)
     {
         return((ScheduledTimelineItem)null);
     }
     foreach (TimelineItem timelineItem in (Collection <TimelineItem>)parentTimelineItem.Children)
     {
         AnimationTimelineItem animationTimelineItem = timelineItem as AnimationTimelineItem;
         if (animationTimelineItem != null && animationTimelineItem.parentTimeline == parentTimeline && animationTimelineItem.TargetProperty.Path == targetProperty.Path)
         {
             return((ScheduledTimelineItem)animationTimelineItem);
         }
         CompoundPropertyTimelineItem propertyTimelineItem = timelineItem as CompoundPropertyTimelineItem;
         if (propertyTimelineItem != null)
         {
             ScheduledTimelineItem scheduledTimelineItem = ScheduledTimelineItem.FindItem((TimelineItem)propertyTimelineItem, parentTimeline, targetProperty);
             if (scheduledTimelineItem != null)
             {
                 return(scheduledTimelineItem);
             }
         }
         BehaviorTimelineItem behaviorTimelineItem = timelineItem as BehaviorTimelineItem;
         if (behaviorTimelineItem != null)
         {
             ScheduledTimelineItem scheduledTimelineItem = ScheduledTimelineItem.FindItem((TimelineItem)behaviorTimelineItem, parentTimeline, targetProperty);
             if (scheduledTimelineItem != null)
             {
                 return(scheduledTimelineItem);
             }
         }
         EffectTimelineItem effectTimelineItem = timelineItem as EffectTimelineItem;
         if (effectTimelineItem != null)
         {
             ScheduledTimelineItem scheduledTimelineItem = ScheduledTimelineItem.FindItem((TimelineItem)effectTimelineItem, parentTimeline, targetProperty);
             if (scheduledTimelineItem != null)
             {
                 return(scheduledTimelineItem);
             }
         }
     }
     return((ScheduledTimelineItem)null);
 }