internal void DeleteTriggerNode(SceneNodeProperty triggerProperty)
        {
            ISceneNodeCollection <SceneNode> collectionForProperty = this.behaviorNode.GetCollectionForProperty(BehaviorHelper.BehaviorTriggersProperty);
            SceneNode valueAsSceneNode = this.behaviorNode.GetLocalValueAsSceneNode(triggerProperty.Reference);
            int       position         = this.TriggerNodeView.CurrentPosition;
            int       num = this.TriggerNodes.IndexOf((PropertyEntry)triggerProperty);

            if (position > num)
            {
                --position;
            }
            else if (position == num)
            {
                position = -1;
            }
            using (SceneEditTransaction editTransaction = this.sceneViewModel.CreateEditTransaction(string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.DeleteBehaviorCommandTriggerUndo, new object[1]
            {
                (object)valueAsSceneNode.TargetType.Name
            })))
            {
                collectionForProperty.Remove(valueAsSceneNode);
                editTransaction.Commit();
            }
            this.Rebuild();
            this.TriggerNodeView.MoveCurrentToPosition(position);
        }
        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);
        }