Exemplo n.º 1
0
        private void UpdateProperties()
        {
            if (this.rotationAnglesProperty != null)
            {
                this.rotationAnglesProperty.OnRemoveFromCategory();
                this.rotationAnglesProperty = (PropertyReferenceProperty)null;
            }
            if (this.rotationProperty != null)
            {
                this.rotationProperty.PropertyReferenceChanged -= new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnRotationProperty_PropertyReferenceChanged);
                this.rotationProperty.OnRemoveFromCategory();
                this.rotationProperty = (PropertyReferenceProperty)null;
            }
            if (this.transformGroupRotationProperty != null)
            {
                this.transformGroupRotationProperty.PropertyReferenceChanged -= new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnRotationProperty_PropertyReferenceChanged);
                this.transformGroupRotationProperty.OnRemoveFromCategory();
                this.transformGroupRotationProperty = (PropertyReferenceProperty)null;
            }
            if (this.objectSet == null)
            {
                return;
            }
            IPlatform         platform           = this.objectSet.ProjectContext.Platform;
            PropertyReference propertyReference1 = new PropertyReference((ReferenceStep)platform.Metadata.GetProperty(platform.Metadata.DefaultTypeResolver, typeof(Transform3DGroup), MemberType.LocalProperty, "Children"), (ReferenceStep)IndexedClrPropertyReferenceStep.GetReferenceStep(platform.Metadata.DefaultTypeResolver, typeof(Transform3DCollection), CanonicalTransformOrder.RotateIndex));
            PropertyReference drotationReference = platform.Metadata.CommonProperties.RotateTransform3DRotationReference;
            ReferenceStep     step = (ReferenceStep)DesignTimeProperties.ResolveDesignTimeReferenceStep(DesignTimeProperties.EulerAnglesProperty, (IPlatformMetadata)platform.Metadata);
            PropertyReference propertyReference2 = platform.Metadata.CommonProperties.RotateTransform3DReference.Append(step);

            if (this.objectSet is SceneNodeObjectSet)
            {
                this.rotationAnglesReference = this.propertyReference.Append(propertyReference2);
                this.rotationReference       = this.propertyReference.Append(drotationReference);
                propertyReference1           = this.propertyReference.Append(propertyReference1);
            }
            else
            {
                this.rotationAnglesReference = propertyReference2;
                this.rotationReference       = drotationReference;
            }
            this.rotationAnglesProperty = this.objectSet.CreateProperty(this.rotationAnglesReference, (AttributeCollection)null);
            this.rotationProperty       = this.objectSet.CreateProperty(this.rotationReference, (AttributeCollection)null);
            this.rotationProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnRotationProperty_PropertyReferenceChanged);
            this.transformGroupRotationProperty             = this.objectSet.CreateProperty(propertyReference1, (AttributeCollection)null);
            this.transformGroupRotationProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnRotationProperty_PropertyReferenceChanged);
            this.OnPropertyChanged("EulerX");
            this.OnPropertyChanged("EulerY");
            this.OnPropertyChanged("EulerZ");
            this.OnPropertyChanged("OrientationFromEulerAngles");
        }
Exemplo n.º 2
0
 internal static void Initialize(DesignerContext designerContext)
 {
     CanonicalTransform3D.EulerAnglesProperty = (DependencyProperty)DesignTimeProperties.ResolveDesignTimeReferenceStep(DesignTimeProperties.EulerAnglesProperty, (IPlatformMetadata)designerContext.DesignerDefaultPlatformService.DefaultPlatform.Metadata).DependencyProperty;
 }
Exemplo n.º 3
0
        public static string GetName(object target, IPlatformMetadata platformMetadata)
        {
            DependencyPropertyReferenceStep dependencyPropertyReferenceStep = DesignTimeProperties.ResolveDesignTimeReferenceStep(DesignTimeProperties.XNameProperty, platformMetadata);

            return((string)dependencyPropertyReferenceStep.GetValue(target));
        }
Exemplo n.º 4
0
        public static void SetName(object target, string name, IPlatformMetadata platformMetadata)
        {
            DependencyPropertyReferenceStep dependencyPropertyReferenceStep = DesignTimeProperties.ResolveDesignTimeReferenceStep(DesignTimeProperties.XNameProperty, platformMetadata);

            dependencyPropertyReferenceStep.SetValue(target, name);
        }
Exemplo n.º 5
0
        public override void Serialize()
        {
            IDocumentContext documentContext = this.TextSource.DocumentContext;
            IPlatformTypes   metadata        = this.ProxyPlatform.Metadata;
            DependencyPropertyReferenceStep propertyReferenceStep = DesignTimeProperties.ResolveDesignTimeReferenceStep(DesignTimeProperties.UpdateContextProperty, (IPlatformMetadata)metadata);

            switch (this.SerializationType)
            {
            case RichTextSerializationType.FlowDocument:
                this.richTextBox.SetValue(metadata.DefaultTypeResolver, (IProperty)propertyReferenceStep, (object)this.instanceDictionary);
                this.flowDocumentNode = (DocumentCompositeNode)documentContext.CreateNode(typeof(FlowDocument), (object)(FlowDocument)this.richTextBox.Document.PlatformSpecificObject);
                this.richTextBox.ClearValue((IProperty)propertyReferenceStep);
                break;

            case RichTextSerializationType.BlockCollection:
                this.richTextBox.SetValue(metadata.DefaultTypeResolver, (IProperty)propertyReferenceStep, (object)this.instanceDictionary);
                this.blockCollectionNode = documentContext.CreateNode(PlatformTypes.BlockCollection);
                foreach (IViewBlock viewBlock in (IEnumerable <IViewBlock>) this.richTextBox.BlockContainer.Blocks)
                {
                    IViewParagraph viewParagraph = viewBlock as IViewParagraph;
                    if (viewParagraph == null)
                    {
                        IViewTextRange textRange = this.ProxyPlatform.ViewTextObjectFactory.CreateTextRange(this.richTextBox.BlockContainer, viewBlock.ContentStart, viewBlock.ContentEnd);
                        viewParagraph = this.ProxyPlatform.ViewTextObjectFactory.CreateParagraph();
                        IViewRun run = this.ProxyPlatform.ViewTextObjectFactory.CreateRun();
                        run.Text = textRange.Text;
                        viewParagraph.Inlines.Add((IViewInline)run);
                    }
                    this.blockCollectionNode.Children.Add(this.PostProcessDocumentNodeFromEditProxy(this.TextSource.ViewModel.DefaultView.ConvertFromWpfValueAsDocumentNode(viewParagraph.PlatformSpecificObject)));
                }
                this.richTextBox.ClearValue((IProperty)propertyReferenceStep);
                break;

            case RichTextSerializationType.InlineCollection:
                this.inlinesCollectionNode = documentContext.CreateNode(PlatformTypes.InlineCollection);
                using (IEnumerator <IViewBlock> enumerator = this.richTextBox.Document.Blocks.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        IViewBlock     current       = enumerator.Current;
                        IViewParagraph viewParagraph = current as IViewParagraph;
                        if (viewParagraph != null)
                        {
                            this.ProcessInlinesForSerialization(viewParagraph.Inlines);
                            if (current.PlatformSpecificObject != ((FlowDocument)this.richTextBox.Document.PlatformSpecificObject).Blocks.LastBlock)
                            {
                                this.inlinesCollectionNode.Children.Add(this.TextSource.ViewModel.DefaultView.ConvertFromWpfValueAsDocumentNode((object)new LineBreak()));
                            }
                        }
                        else
                        {
                            Microsoft.Expression.DesignModel.DocumentModel.DocumentNode documentNode = this.TextSource.ViewModel.DefaultView.ConvertFromWpfValueAsDocumentNode((object)new Run(new TextRange(((TextElement)current.PlatformSpecificObject).ContentStart, ((TextElement)current.PlatformSpecificObject).ContentEnd).Text));
                            if (documentNode != null)
                            {
                                this.inlinesCollectionNode.Children.Add(documentNode);
                            }
                        }
                    }
                    break;
                }
            }
        }