Ejemplo n.º 1
0
 private static RoutedEventInformation FromName(ITypeResolver typeResolver, string eventName, IType typeId)
 {
     foreach (RoutedEventInformation eventInformation in EventInformation.GetEventsForType(typeResolver, typeId, MemberType.RoutedEvent))
     {
         if (eventInformation.EventName == eventName)
         {
             return(eventInformation);
         }
     }
     return((RoutedEventInformation)null);
 }
Ejemplo n.º 2
0
        public static RoutedEventInformation GetDefaultEvent(ITypeResolver typeResolver, IType typeId)
        {
            RoutedEventInformation eventInformation1 = (RoutedEventInformation)null;

            foreach (RoutedEventInformation eventInformation2 in EventInformation.GetEventsForType(typeResolver, typeId, MemberType.RoutedEvent))
            {
                if (eventInformation2.RoutedEvent != null && eventInformation2.RoutedEvent == FrameworkElement.LoadedEvent)
                {
                    return(eventInformation2);
                }
                if ((TriggerSourceInformation)eventInformation1 == (TriggerSourceInformation)null)
                {
                    eventInformation1 = eventInformation2;
                }
            }
            return(eventInformation1);
        }
Ejemplo n.º 3
0
        private static void FixUpEventNameImpl(BehaviorEventTriggerNode eventTriggerNode, SceneNode sourceNode)
        {
            if (sourceNode == null)
            {
                return;
            }
            IEnumerable <EventInformation> eventsForType = EventInformation.GetEventsForType((ITypeResolver)eventTriggerNode.ProjectContext, sourceNode.Type, MemberType.LocalEvent);

            if (!Enumerable.Any <EventInformation>(eventsForType, (Func <EventInformation, bool>)(info => info.EventName.Equals(eventTriggerNode.EventName, StringComparison.Ordinal))))
            {
                bool flag = false;
                DefaultEventAttribute defaultEventAttribute = TypeUtilities.GetAttribute <DefaultEventAttribute>(sourceNode.TargetType);
                if (defaultEventAttribute != null && !string.IsNullOrEmpty(defaultEventAttribute.Name) && (TriggerSourceInformation)Enumerable.SingleOrDefault <EventInformation>(eventsForType, (Func <EventInformation, bool>)(eventInfo => eventInfo.EventName == defaultEventAttribute.Name)) != (TriggerSourceInformation)null)
                {
                    eventTriggerNode.SetValue(BehaviorEventTriggerNode.EventNameProperty, (object)defaultEventAttribute.Name);
                    flag = true;
                }
                if (!flag && Enumerable.Any <EventInformation>(eventsForType, (Func <EventInformation, bool>)(info => info.EventName.Equals("Loaded", StringComparison.Ordinal))))
                {
                    eventTriggerNode.SetValue(BehaviorEventTriggerNode.EventNameProperty, (object)"Loaded");
                }
                else
                {
                    eventTriggerNode.ClearValue(BehaviorEventTriggerNode.EventNameProperty);
                }
            }
            ISceneNodeCollection <SceneNode> collectionForProperty = eventTriggerNode.Parent.GetCollectionForProperty(BehaviorHelper.BehaviorTriggersProperty);
            BehaviorTriggerBaseNode          matchingTriggerNode   = BehaviorHelper.FindMatchingTriggerNode(eventTriggerNode.DocumentNode, collectionForProperty);

            if (matchingTriggerNode == null || matchingTriggerNode.Equals((object)eventTriggerNode))
            {
                return;
            }
            for (int index = eventTriggerNode.Actions.Count - 1; index >= 0; --index)
            {
                BehaviorTriggerActionNode action = (BehaviorTriggerActionNode)eventTriggerNode.Actions[index];
                BehaviorHelper.ReparentAction(collectionForProperty, (BehaviorTriggerBaseNode)eventTriggerNode, matchingTriggerNode, action);
            }
            collectionForProperty.Remove((SceneNode)eventTriggerNode);
        }
Ejemplo n.º 4
0
        private void Rebuild()
        {
            SceneNodeProperty            sceneNodeProperty    = this.editingProperty;
            BehaviorEventTriggerBaseNode eventTriggerBaseNode = sceneNodeProperty != null ? sceneNodeProperty.SceneNodeObjectSet.RepresentativeSceneNode as BehaviorEventTriggerBaseNode : (BehaviorEventTriggerBaseNode)null;

            this.events     = eventTriggerBaseNode == null || eventTriggerBaseNode.SourceNode == null ? (IEnumerable <EventInformation>) new List <EventInformation>() : EventInformation.GetEventsForType((ITypeResolver)sceneNodeProperty.SceneNodeObjectSet.ProjectContext, eventTriggerBaseNode.SourceNode.Type, MemberType.LocalEvent);
            this.eventsView = CollectionViewSource.GetDefaultView((object)this.events);
            this.eventsView.GroupDescriptions.Add((GroupDescription) new PropertyGroupDescription()
            {
                PropertyName = "GroupBy"
            });
            this.eventsView.SortDescriptions.Add(new SortDescription());
            this.OnPropertyChanged("CurrentEvent");
            this.OnPropertyChanged("Events");
        }