コード例 #1
0
 public PlatformTypesValidationExtension(IPlatformMetadata platformMetadata)
 {
     this.platformMetadata = platformMetadata;
     this.collectionTypes  = new List <Type>((int)PlatformTypesValidationExtension.CollectionTypes.Length);
     for (int i = 0; i < (int)PlatformTypesValidationExtension.CollectionTypes.Length; i++)
     {
         Type runtimeType = platformMetadata.ResolveType(PlatformTypesValidationExtension.CollectionTypes[i]).RuntimeType;
         if (runtimeType != null)
         {
             this.collectionTypes.Add(runtimeType);
         }
     }
     this.objectTypes = new List <Type>((int)PlatformTypesValidationExtension.ObjectTypes.Length);
     for (int j = 0; j < (int)PlatformTypesValidationExtension.ObjectTypes.Length; j++)
     {
         Type type = platformMetadata.ResolveType(PlatformTypesValidationExtension.ObjectTypes[j]).RuntimeType;
         if (type != null)
         {
             this.objectTypes.Add(type);
         }
     }
     this.replacementCollectionType = this.platformMetadata.ResolveType(PlatformTypes.ObservableCollection).RuntimeType;
     this.baseCollectionType        = this.platformMetadata.ResolveType(PlatformTypes.IList).RuntimeType;
     this.objectType = this.platformMetadata.ResolveType(PlatformTypes.Object).RuntimeType;
 }
コード例 #2
0
ファイル: ThicknessEditor.cs プロジェクト: radtek/Shopdrawing
        private void Rebuild()
        {
            PropertyValue             propertyValue     = this.DataContext as PropertyValue;
            PropertyReferenceProperty referenceProperty = (PropertyReferenceProperty)null;

            if (propertyValue != null)
            {
                referenceProperty = (PropertyReferenceProperty)propertyValue.get_ParentProperty();
            }
            if (referenceProperty == this.editingProperty)
            {
                return;
            }
            this.Unhook();
            this.editingProperty = referenceProperty;
            if (this.editingProperty == null)
            {
                return;
            }
            PropertyReference  reference          = this.editingProperty.Reference;
            SceneNodeObjectSet sceneNodeObjectSet = (SceneNodeObjectSet)this.editingProperty.ObjectSet;
            IPlatformMetadata  platformMetadata   = reference.PlatformMetadata;
            ReferenceStep      step1 = (ReferenceStep)platformMetadata.ResolveProperty(ThicknessNode.TopProperty);
            ReferenceStep      step2 = (ReferenceStep)platformMetadata.ResolveProperty(ThicknessNode.LeftProperty);
            ReferenceStep      step3 = (ReferenceStep)platformMetadata.ResolveProperty(ThicknessNode.RightProperty);
            ReferenceStep      step4 = (ReferenceStep)platformMetadata.ResolveProperty(ThicknessNode.BottomProperty);
            Type runtimeType         = platformMetadata.ResolveType(PlatformTypes.Thickness).RuntimeType;

            this.top    = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step1), step1.Attributes);
            this.left   = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step2), step2.Attributes);
            this.right  = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step3), step3.Attributes);
            this.bottom = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step4), step4.Attributes);
            ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.left, "Left");
            ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.top, "Top");
            ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.right, "Right");
            ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.bottom, "Bottom");
            this.TopPropertyContainer.set_PropertyEntry((PropertyEntry)this.top);
            this.LeftPropertyContainer.set_PropertyEntry((PropertyEntry)this.left);
            this.RightPropertyContainer.set_PropertyEntry((PropertyEntry)this.right);
            this.BottomPropertyContainer.set_PropertyEntry((PropertyEntry)this.bottom);
        }
コード例 #3
0
        private static string GetNameFromNearestNonEmptyContentPropertyAttribute(IPlatformMetadata platformMetadata, Type type, out bool anySkipped)
        {
            anySkipped = false;
            IType         type1              = platformMetadata.ResolveType(PlatformTypes.ContentPropertyAttribute);
            ReferenceStep member             = (ReferenceStep)type1.GetMember(MemberType.Property, "Name", MemberAccessTypes.Public);
            string        valueFromAttribute = ClrObjectMetadata.GetValueFromAttribute(type1, member, type, true) as string;

            if (!string.IsNullOrEmpty(valueFromAttribute))
            {
                return(valueFromAttribute);
            }
            while (type != null)
            {
                valueFromAttribute = ClrObjectMetadata.GetValueFromAttribute(type1, member, type, false) as string;
                if (!string.IsNullOrEmpty(valueFromAttribute))
                {
                    anySkipped = true;
                    return(valueFromAttribute);
                }
                type = type.BaseType;
            }
            return(null);
        }