private void CheckAndProcessIdentifiableMember([NotNull] IMemberNode member)
        {
            var identifiable = member.Retrieve() as IIdentifiable;

            if (identifiable == null)
            {
                return;
            }

            ProcessIdentifiableMembers(identifiable, member);
        }
예제 #2
0
 /// <inheritdoc/>
 protected override bool ShouldVisitMemberTarget(IMemberNode member)
 {
     return(base.ShouldVisitMemberTarget(member) && !PropertyGraphDefinition.IsMemberTargetObjectReference(member, member.Retrieve()));
 }
예제 #3
0
        public override TContentType GetNodeValue()
        {
            var value = (TContentType)Node.Retrieve();

            return(value);
        }
예제 #4
0
        /// <inheritdoc />
        protected override void Initialize()
        {
            base.Initialize();

            var invalidIndices = new Stack <int>();

            for (var i = 0; i < Asset.ChildrenIds.Count; i++)
            {
                var childId    = Asset.ChildrenIds[i];
                var childScene = Session.GetAssetById(childId) as SceneViewModel;
                if (childScene == null)
                {
                    // Mark this id for deletion
                    invalidIndices.Push(i);
                    continue;
                }

                // We trust the child's Parent property. Let's check the relationship or fix it.
                var parentValue     = childScene.parentNode.Retrieve();
                var parentReference = AttachedReferenceManager.GetAttachedReference(parentValue);
                if (parentReference?.Id != Id)
                {
                    // Mark this id for deletion
                    invalidIndices.Push(i);
                    // If the parent is already initialized and the child is connected, there is nothing to do
                    if (childScene.Parent?.isInitialized == true)
                    {
                        Debug.Assert(childScene.Parent.Children.Contains(childScene));
                    }
                    else
                    {
                        // Otherwise: fixup the parent child relationship
                        FixupParentChild(childScene, parentReference);
                    }
                }
                else
                {
                    // Everything good
                    childScene.parent = this;
                    Children.Add(childScene);
                }
            }
            foreach (var index in invalidIndices)
            {
                childrenNode.Remove(Asset.ChildrenIds[index], new NodeIndex(index));
            }

            if (Parent?.isInitialized == true)
            {
                Debug.Assert(Parent.Children.Contains(this));
            }
            else
            {
                var parentValue     = parentNode.Retrieve();
                var parentReference = AttachedReferenceManager.GetAttachedReference(parentValue);
                FixupParentChild(this, parentReference);
            }

            Children.CollectionChanged += ChildrenCollectionChanged;
            childrenNode.ItemChanged   += ChildrenNodeItemChanged;
            parentNode.ValueChanged    += ParentNodeValueChanged;
            isInitialized = true;
        }
예제 #5
0
        /// <summary>
        /// Gets the current value of the graph node.
        /// </summary>
        /// <returns>The current value of the graph node.</returns>
        /// <remarks>This method can be invoked from a property getter.</remarks>
        public TContentType GetNodeValue()
        {
            var value = (TContentType)node.Retrieve();

            return(value);
        }