コード例 #1
0
        private ReferenceStep ResolveTypeIdProperty(ITypeId typeId, string propertyName)
        {
            IType type = this.TypeResolver.ResolveType(typeId);

            if (type == null || this.TypeResolver.PlatformMetadata.IsNullType((ITypeId)type))
            {
                return((ReferenceStep)null);
            }
            return(PlatformTypeHelper.GetProperty(this.TypeResolver, (ITypeId)type, MemberType.Property, propertyName));
        }
コード例 #2
0
        public PathEditorTarget GetPathEditorTarget(Base2DElement element, PathEditMode pathEditMode)
        {
            if (element == null)
            {
                return((PathEditorTarget)null);
            }
            List <PathEditorTarget> list;

            if (this.map.TryGetValue(element, out list))
            {
                foreach (PathEditorTarget pathEditorTarget in list)
                {
                    if (pathEditorTarget.PathEditMode == pathEditMode)
                    {
                        pathEditorTarget.RefreshSubscription();
                        return(pathEditorTarget);
                    }
                }
            }
            else
            {
                list = new List <PathEditorTarget>();
                this.map.Add(element, list);
            }
            PathEditorTarget pathEditorTarget1 = (PathEditorTarget)null;

            if (pathEditMode == PathEditMode.ScenePath)
            {
                PathElement pathElement = element as PathElement;
                if (pathElement == null)
                {
                    return((PathEditorTarget)null);
                }
                ReferenceStep property = PlatformTypeHelper.GetProperty((ITypeResolver)element.ProjectContext, (ITypeId)element.Type, MemberType.Property, "Data");
                if (property == null || !property.ShouldSerialize)
                {
                    return((PathEditorTarget)null);
                }
                pathEditorTarget1 = (PathEditorTarget) new ScenePathEditorTarget(pathElement);
            }
            else if (pathEditMode == PathEditMode.MotionPath)
            {
                pathEditorTarget1 = (PathEditorTarget) new MotionPathEditorTarget(element);
            }
            else if (pathEditMode == PathEditMode.ClippingPath)
            {
                pathEditorTarget1 = (PathEditorTarget) new ClippingPathEditorTarget(element);
            }
            list.Add(pathEditorTarget1);
            return(pathEditorTarget1);
        }
コード例 #3
0
        public void UpdatePropertyContainers(TransformPropertyLookup propertyLookup)
        {
            AttributeCollection attributes = new AttributeCollection(new Attribute[2]
            {
                (Attribute) new NumberRangesAttribute(new double?(double.NegativeInfinity), new double?(0.0), new double?(1.0), new double?(double.PositiveInfinity), new bool?()),
                (Attribute) new NumberIncrementsAttribute(new double?(0.01), new double?(0.05), new double?(0.1))
            });
            ITypeResolver     typeResolver      = (ITypeResolver)propertyLookup.TransformProperty.SceneNodeObjectSet.ProjectContext;
            PropertyReference propertyReference = new PropertyReference(typeResolver.ResolveProperty(Base2DElement.RenderTransformOriginProperty) as ReferenceStep);
            ReferenceStep     property1         = PlatformTypeHelper.GetProperty(typeResolver, PlatformTypes.Point, MemberType.LocalProperty, "X");
            ReferenceStep     property2         = PlatformTypeHelper.GetProperty(typeResolver, PlatformTypes.Point, MemberType.LocalProperty, "Y");

            this.renderTransformOriginXProperty = propertyReference.Append(property1);
            this.renderTransformOriginYProperty = propertyReference.Append(property2);
            PropertyReference reference = propertyLookup.TransformProperty.Reference;

            if (reference.Count == 1 && reference.FirstStep.Equals((object)Base2DElement.RenderTransformProperty))
            {
                if (propertyLookup.Relative)
                {
                    this.CenterPointXEditor.PropertyEntry = (PropertyEntry)null;
                    this.CenterPointYEditor.PropertyEntry = (PropertyEntry)null;
                }
                else
                {
                    this.CenterPointXEditor.PropertyEntry = (PropertyEntry)propertyLookup.CreateNormalProperty(this.renderTransformOriginXProperty, attributes);
                    this.CenterPointYEditor.PropertyEntry = (PropertyEntry)propertyLookup.CreateNormalProperty(this.renderTransformOriginYProperty, attributes);
                }
            }
            else
            {
                this.CenterPointXEditor.PropertyEntry = (PropertyEntry)propertyLookup.CreateProperty("CenterX", attributes);
                this.CenterPointYEditor.PropertyEntry = (PropertyEntry)propertyLookup.CreateProperty("CenterY", attributes);
            }
            if (propertyLookup.TransformType == TransformType.Transform3D)
            {
                this.CenterPointZEditor.PropertyEntry = (PropertyEntry)propertyLookup.CreateProperty("CenterZ", attributes);
            }
            else
            {
                this.CenterPointZEditor.PropertyEntry = (PropertyEntry)null;
            }
        }
コード例 #4
0
ファイル: TextEditProxy.cs プロジェクト: radtek/Shopdrawing
        protected virtual void CopyProperty(IPropertyId propertyId)
        {
            DependencyPropertyReferenceStep propertyReferenceStep = this.TextSource.DesignerContext.DesignerDefaultPlatformService.DefaultPlatform.Metadata.ResolveProperty(propertyId) as DependencyPropertyReferenceStep;
            ReferenceStep referenceStep1 = PlatformTypes.IsExpressionInteractiveType(PlatformTypeHelper.GetDeclaringType((IMember)propertyReferenceStep)) ? (ReferenceStep)propertyReferenceStep : PlatformTypeHelper.GetProperty((ITypeResolver)this.TextSource.ProjectContext, (ITypeId)this.TextSource.Type, MemberType.LocalProperty, propertyReferenceStep.Name);

            if (referenceStep1 == null)
            {
                return;
            }
            object computedValueAsWpf = this.TextSource.GetComputedValueAsWpf((IPropertyId)referenceStep1);

            if (!this.TextSource.ProjectContext.IsCapabilitySet(PlatformCapability.IsWpf))
            {
                if (DesignTimeProperties.GetShadowProperty((IProperty)referenceStep1, (ITypeId)this.TextSource.Type) != null)
                {
                    for (SceneNode sceneNode = (SceneNode)this.TextSource; sceneNode != null; sceneNode = sceneNode.Parent)
                    {
                        IProperty property = PlatformTypes.IsExpressionInteractiveType(PlatformTypeHelper.GetDeclaringType((IMember)referenceStep1)) ? (IProperty)referenceStep1 : (IProperty)PlatformTypeHelper.GetProperty((ITypeResolver)this.TextSource.ProjectContext, (ITypeId)sceneNode.Type, MemberType.LocalProperty, referenceStep1.Name);
                        if (property != null && sceneNode.IsSet((IPropertyId)property) == PropertyState.Set)
                        {
                            computedValueAsWpf = sceneNode.GetComputedValueAsWpf((IPropertyId)property);
                            break;
                        }
                    }
                }
            }
            try
            {
                ReferenceStep referenceStep2 = referenceStep1;
                if (!this.TextSource.ProjectContext.IsCapabilitySet(PlatformCapability.IsWpf))
                {
                    referenceStep2 = (ReferenceStep)propertyReferenceStep;
                }
                referenceStep2.SetValue(this.EditingElement.PlatformSpecificObject, computedValueAsWpf);
            }
            catch
            {
            }
        }
コード例 #5
0
        public void Rebuild()
        {
            foreach (PropertyBase propertyBase in this.subProperties)
            {
                propertyBase.Associated = false;
            }
            PropertyDescriptorCollection descriptorCollection = (PropertyDescriptorCollection)null;
            Type         targetType = this.parentProperty.PropertyType;
            bool         isMixed;
            DocumentNode valueAsDocumentNode = this.parentProperty.GetLocalValueAsDocumentNode(true, out isMixed);

            if (valueAsDocumentNode == null || !(valueAsDocumentNode is DocumentPrimitiveNode) && !valueAsDocumentNode.Type.IsBinding)
            {
                TypeConverter converterFromAttributes = MetadataStore.GetTypeConverterFromAttributes(targetType.Assembly, this.parentProperty.Attributes);
                if (converterFromAttributes != null)
                {
                    object obj = this.parentProperty.SceneNodeObjectSet.GetValue(this.parentProperty.Reference, this.parentProperty.IsExpression ? PropertyReference.GetValueFlags.Computed : PropertyReference.GetValueFlags.Local);
                    if (obj != null && obj != MixedProperty.Mixed)
                    {
                        descriptorCollection = converterFromAttributes.GetProperties(obj);
                        targetType           = obj.GetType();
                    }
                }
                if (descriptorCollection == null)
                {
                    object component = this.parentProperty.SceneNodeObjectSet.GetValue(this.parentProperty.Reference, this.parentProperty.IsExpression ? PropertyReference.GetValueFlags.Computed : PropertyReference.GetValueFlags.Local);
                    if (component != null && component != MixedProperty.Mixed)
                    {
                        descriptorCollection = TypeUtilities.GetProperties(component);
                        targetType           = component.GetType();
                    }
                }
            }
            this.objectSet.RebuildObjects();
            IProjectContext projectContext = this.parentProperty.SceneNodeObjectSet.ProjectContext;

            if (projectContext != null && descriptorCollection != null)
            {
                SceneNode[] objects = this.objectSet.Objects;
                foreach (PropertyDescriptor propertyDescriptor in descriptorCollection)
                {
                    ReferenceStep referenceStep = PlatformTypeHelper.GetProperty((ITypeResolver)projectContext, targetType, propertyDescriptor) as ReferenceStep;
                    if (referenceStep != null)
                    {
                        TargetedReferenceStep targetedReferenceStep = new TargetedReferenceStep(referenceStep, this.objectSet.ObjectTypeId);
                        if (PropertyInspectorModel.IsPropertyBrowsable(objects, targetedReferenceStep) && PropertyInspectorModel.IsAttachedPropertyBrowsable(objects, this.objectSet.ObjectTypeId, targetedReferenceStep, (ITypeResolver)this.parentProperty.SceneNodeObjectSet.ProjectContext))
                        {
                            PropertyReference propertyReference = new PropertyReference(referenceStep);
                            SceneNodeProperty property          = this.FindProperty(propertyReference);
                            if (property == null)
                            {
                                SceneNodeProperty sceneNodeProperty = this.objectSet.CreateProperty(propertyReference, referenceStep.Attributes) as SceneNodeProperty;
                                int index = this.subProperties.BinarySearch(sceneNodeProperty, (IComparer <SceneNodeProperty>) new SceneNodePropertyCollection.PropertyNameComparer());
                                if (index < 0)
                                {
                                    index = ~index;
                                }
                                this.subProperties.Insert(index, sceneNodeProperty);
                                this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, (object)sceneNodeProperty, index));
                            }
                            else if (!property.UpdateAndRefresh(propertyReference, referenceStep.Attributes, (Type)null))
                            {
                                property.Associated = true;
                            }
                        }
                    }
                }
            }
            for (int index = this.subProperties.Count - 1; index >= 0; --index)
            {
                if (!this.subProperties[index].Associated)
                {
                    PropertyEntry propertyEntry = (PropertyEntry)this.subProperties[index];
                    this.subProperties[index].OnRemoveFromCategory();
                    this.subProperties.RemoveAt(index);
                    this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, (object)propertyEntry, index));
                }
            }
            this.OnPropertyChanged("Item[]");
        }