コード例 #1
0
        private static IEnumerable <ReferenceStep> GetPropertiesForSceneNode(SceneNode node)
        {
            TextRangeElement textRange = node as TextRangeElement;

            if (textRange != null)
            {
                foreach (IPropertyId propertyId in textRange.RangeProperties)
                {
                    DependencyPropertyReferenceStep dp = node.ProjectContext.ResolveProperty(propertyId) as DependencyPropertyReferenceStep;
                    if (dp != null)
                    {
                        yield return((ReferenceStep)dp);
                    }
                }
            }
            else
            {
                foreach (IProperty property in ITypeExtensions.GetProperties(PropertyMerger.GetTypeFromSceneNode(node), MemberAccessTypes.Public, true))
                {
                    ReferenceStep referenceStep = property as ReferenceStep;
                    if (referenceStep != null)
                    {
                        DependencyPropertyReferenceStep dependencyPropertyReferenceStep = referenceStep as DependencyPropertyReferenceStep;
                        if (dependencyPropertyReferenceStep == null || !dependencyPropertyReferenceStep.IsAttachable)
                        {
                            yield return(referenceStep);
                        }
                    }
                }
            }
        }
コード例 #2
0
        private DocumentCompositeNode BuildCompositeNode(IType type)
        {
            DocumentCompositeNode node = this.documentContext.CreateNode((ITypeId)type);

            ++this.complexDepth;
            bool recursionLimitReached = this.complexDepth > DesignDataGenerator.maxComplexDepth && !this.IsCollectionRecent;
            MemberAccessTypes  allowableMemberAccess = TypeHelper.GetAllowableMemberAccess(this.documentContext.TypeResolver, type);
            SortedSet <string> sortedSet             = new SortedSet <string>();

            foreach (IProperty property in ITypeExtensions.GetProperties(type, allowableMemberAccess, true))
            {
                if (!sortedSet.Contains(property.Name))
                {
                    sortedSet.Add(property.Name);
                    if (DesignDataGenerator.IsPropertyWritable(property, this.documentContext.TypeResolver))
                    {
                        DocumentNode documentNode = this.BuildNode(property.PropertyType, true, recursionLimitReached);
                        if (documentNode != null)
                        {
                            node.Properties[(IPropertyId)property] = documentNode;
                        }
                    }
                }
            }
            if (type.ItemType != null && (this.IsTypeXamlFriendly(type.ItemType) || this.CanBuildSimpleNode(type.ItemType)))
            {
                this.stack.Add(DesignDataGenerator.NodeType.Collection);
                this.BuildCollectionNode(type, node);
                this.stack.RemoveAt(this.stack.Count - 1);
            }
            --this.complexDepth;
            return(node);
        }
コード例 #3
0
 public override void OnSelectionChanged(SceneNode[] selectedObjects)
 {
     base.OnSelectionChanged(selectedObjects);
     if (this.objectSet != null)
     {
         this.objectSet.Dispose();
         this.objectSet = (TriggerObjectSet)null;
     }
     this.selectedObjects = selectedObjects;
     if (selectedObjects.Length > 0)
     {
         SceneNode sceneNode = selectedObjects[0];
         if (sceneNode != null && ProjectNeutralTypes.BehaviorTriggerAction.IsAssignableFrom((ITypeId)sceneNode.Type))
         {
             BehaviorTriggerBaseNode behaviorTriggerBaseNode = sceneNode.Parent as BehaviorTriggerBaseNode;
             if (behaviorTriggerBaseNode != null)
             {
                 this.objectSet   = new TriggerObjectSet((BehaviorTriggerActionNode)sceneNode);
                 this.TriggerType = behaviorTriggerBaseNode.Type;
                 List <TargetedReferenceStep> list = new List <TargetedReferenceStep>();
                 foreach (IProperty property in ITypeExtensions.GetProperties(behaviorTriggerBaseNode.Type, MemberAccessTypes.Public, true))
                 {
                     ReferenceStep referenceStep = property as ReferenceStep;
                     if (referenceStep != null)
                     {
                         list.Add(new TargetedReferenceStep(referenceStep, behaviorTriggerBaseNode.Type));
                     }
                 }
                 foreach (TargetedReferenceStep targetedReferenceStep in list)
                 {
                     if (PropertyInspectorModel.IsPropertyBrowsable(this.selectedObjects, targetedReferenceStep))
                     {
                         AttributeCollection attributes     = targetedReferenceStep.Attributes;
                         Attribute[]         attributeArray = new Attribute[attributes.Count + 1];
                         int index;
                         for (index = 0; index < attributes.Count; ++index)
                         {
                             attributeArray[index] = attributes[index];
                         }
                         attributeArray[index] = (Attribute) new CategoryAttribute(CategoryLocalizationHelper.GetLocalizedCategoryName(CategoryLocalizationHelper.CategoryName.Triggers));
                         SceneNodeProperty property = (SceneNodeProperty)this.objectSet.CreateProperty(new PropertyReference(targetedReferenceStep.ReferenceStep), new AttributeCollection(attributeArray));
                         if (!PlatformTypes.IList.IsAssignableFrom((ITypeId)property.PropertyTypeId))
                         {
                             this.AddProperty(property);
                         }
                     }
                 }
             }
         }
     }
     this.OnPropertyChanged("IsEmpty");
 }
コード例 #4
0
        public static IEnumerable <PropertyInformation> GetPropertiesForType(Type objectType, ITypeResolver typeResolver)
        {
            IType type = typeResolver.GetType(objectType);

            if (type != null)
            {
                foreach (IProperty property in ITypeExtensions.GetProperties(type, MemberAccessTypes.PublicOrInternal, true))
                {
                    DependencyPropertyReferenceStep dependencyPropertyReferenceStep = property as DependencyPropertyReferenceStep;
                    if (dependencyPropertyReferenceStep != null)
                    {
                        yield return(new PropertyInformation(dependencyPropertyReferenceStep));
                    }
                }
            }
        }