private void UpdateFromDataContext()
        {
            this.UnhookEditingProperty();
            Microsoft.Windows.Design.PropertyEditing.PropertyValue propertyValue = this.hostControl.DataContext as Microsoft.Windows.Design.PropertyEditing.PropertyValue;
            if (propertyValue != null)
            {
                this.editingProperty = (PropertyReferenceProperty)propertyValue.ParentProperty;
            }
            if (this.editingProperty == null)
            {
                return;
            }
            this.editingProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnEditingPropertyChanged);
            SceneNodeObjectSetBase nodeObjectSetBase = (SceneNodeObjectSetBase)this.editingProperty.ObjectSet;
            ReferenceStep          singleStep1       = (ReferenceStep)nodeObjectSetBase.ProjectContext.ResolveProperty(BehaviorTargetedTriggerActionNode.BehaviorTargetNameProperty);

            if (singleStep1 != null)
            {
                this.targetNameProperty = (SceneNodeProperty)nodeObjectSetBase.CreateProperty(new PropertyReference(singleStep1), (AttributeCollection)null);
                this.targetNameProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnEditingPropertyChanged);
            }
            ReferenceStep singleStep2 = (ReferenceStep)nodeObjectSetBase.ProjectContext.ResolveProperty(BehaviorTargetedTriggerActionNode.BehaviorTargetObjectProperty);

            if (singleStep2 != null)
            {
                this.targetObjectProperty = (SceneNodeProperty)nodeObjectSetBase.CreateProperty(new PropertyReference(singleStep2), (AttributeCollection)null);
                this.targetObjectProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnEditingPropertyChanged);
            }
            this.Rebuild();
        }
Exemple #2
0
        protected override void ModifyValue(PropertyReferenceProperty property, object valueToSet, Modification modification, int index)
        {
            if (this.objects.Length == 0)
            {
                using (this.ViewModel.ForceDefaultSetValue())
                    this.parent.SetValue((PropertyReferenceProperty)this.parentProperty, this.parent.GetValue(this.baseReference, PropertyReference.GetValueFlags.Computed));
                this.RebuildObjects();
            }
            bool treeModified = false;
            SceneEditTransaction sceneEditTransaction = (SceneEditTransaction)null;

            try
            {
                sceneEditTransaction = this.parent.PrepareTreeForModifyValue(this.parentProperty.Reference.Append(property.Reference), valueToSet, modification, out treeModified);
                if (treeModified)
                {
                    this.RebuildObjects();
                }
                base.ModifyValue(property, valueToSet, modification, index);
            }
            finally
            {
                if (sceneEditTransaction != null)
                {
                    sceneEditTransaction.Commit();
                    sceneEditTransaction.Dispose();
                }
            }
        }
Exemple #3
0
 public static bool IsPropertySupportedOnType(PropertyReferenceProperty property, Type selectionType)
 {
     if (!PlatformTypes.ImageSource.IsAssignableFrom((ITypeId)property.PropertyTypeId) && !PlatformTypes.Uri.IsAssignableFrom((ITypeId)property.PropertyTypeId))
     {
         return(PlatformTypes.MultiScaleTileSource.IsAssignableFrom((ITypeId)property.PropertyTypeId));
     }
     return(true);
 }
Exemple #4
0
        public static PropertyValueEditor GetPropertyEditorTemplate(PropertyReferenceProperty property)
        {
            bool                flag                = false;
            IProjectContext     projectContext      = property.ObjectSet.ProjectContext;
            PropertyValueEditor propertyValueEditor = PropertyEditorTemplateLookup.GetPropertyEditorTemplate(projectContext, property.ObjectSet.DesignerContext, property.PropertyTypeId);

            if (propertyValueEditor == PropertyEditorTemplateLookup.ObjectEditorTemplate && property.PropertyValue.CanConvertFromString)
            {
                flag = true;
                propertyValueEditor = (PropertyValueEditor)null;
            }
            SceneNodeProperty sceneNodeProperty = property as SceneNodeProperty;

            if (propertyValueEditor == null)
            {
                if (property.Converter != null && property.Converter.GetPropertiesSupported())
                {
                    return(PropertyEditorTemplateLookup.ObjectEditorTemplate);
                }
                if (sceneNodeProperty != null && UriEditor.IsPropertySupportedOnType((PropertyReferenceProperty)sceneNodeProperty, sceneNodeProperty.SceneNodeObjectSet.ObjectType))
                {
                    DataTemplate inlineEditorTemplate = new DataTemplate();
                    inlineEditorTemplate.VisualTree = new FrameworkElementFactory(typeof(UriEditor));
                    propertyValueEditor             = new PropertyValueEditor(inlineEditorTemplate);
                }
            }
            if (propertyValueEditor == null && !flag)
            {
                IType computedValueTypeId = property.ComputedValueTypeId;
                if (computedValueTypeId != null)
                {
                    propertyValueEditor = PropertyEditorTemplateLookup.GetPropertyEditorTemplate(projectContext, property.ObjectSet.DesignerContext, computedValueTypeId);
                    if (propertyValueEditor is PropertyEditorTemplateLookup.CollectionDialogPropertyValueEditor)
                    {
                        propertyValueEditor = (PropertyValueEditor)null;
                    }
                }
            }
            if (property.IsReadOnly && !(propertyValueEditor is PropertyEditorTemplateLookup.CollectionDialogPropertyValueEditor) && !ProjectNeutralTypes.LayoutPathCollection.IsAssignableFrom((ITypeId)property.PropertyTypeId))
            {
                return((PropertyValueEditor)null);
            }
            if (sceneNodeProperty != null && propertyValueEditor is PropertyEditorTemplateLookup.CollectionDialogPropertyValueEditor)
            {
                bool         isMixed;
                DocumentNode valueAsDocumentNode = sceneNodeProperty.GetLocalValueAsDocumentNode(true, out isMixed);
                if (valueAsDocumentNode != null && valueAsDocumentNode is DocumentPrimitiveNode)
                {
                    return((PropertyValueEditor)null);
                }
                if (property.PropertyTypeId.IsArray && !property.PropertyTypeId.PlatformMetadata.ResolveType(PlatformTypes.ArrayExtension).IsResolvable)
                {
                    return((PropertyValueEditor)null);
                }
            }
            return(propertyValueEditor);
        }
Exemple #5
0
 public override void OnSelectionChanged(SceneNode[] selectedObjects)
 {
     base.OnSelectionChanged(selectedObjects);
     this.selectedCameras.Clear();
     this.cameraType = (object)null;
     if (this.upDirectionProperty != null)
     {
         this.upDirectionProperty.PropertyReferenceChanged -= new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnRotationAngleChanged);
         this.upDirectionProperty = (PropertyReferenceProperty)null;
     }
     if (this.lookDirectionProperty != null)
     {
         this.lookDirectionProperty.PropertyReferenceChanged -= new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnRotationAngleChanged);
         this.lookDirectionProperty = (PropertyReferenceProperty)null;
     }
     foreach (PropertyEntry propertyEntry in (Collection <PropertyEntry>) this.BasicProperties)
     {
         if (propertyEntry.PropertyName == "UpDirection")
         {
             this.upDirectionProperty = propertyEntry as PropertyReferenceProperty;
         }
         else if (propertyEntry.PropertyName == "LookDirection")
         {
             this.lookDirectionProperty = propertyEntry as PropertyReferenceProperty;
         }
     }
     if (this.upDirectionProperty != null)
     {
         this.upDirectionProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnRotationAngleChanged);
     }
     if (this.lookDirectionProperty != null)
     {
         this.lookDirectionProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnRotationAngleChanged);
     }
     foreach (object obj in selectedObjects)
     {
         ProjectionCameraElement projectionCameraElement = obj as ProjectionCameraElement;
         if (projectionCameraElement != null)
         {
             this.selectedCameras.Add(projectionCameraElement);
             if (this.cameraType == null)
             {
                 this.cameraType = (object)projectionCameraElement.TargetType;
             }
             else if (!object.Equals(this.cameraType, (object)projectionCameraElement.TargetType))
             {
                 this.cameraType = MixedProperty.Mixed;
             }
         }
     }
     this.OnPropertyChanged("IsCameraOrthographic");
     this.OnPropertyChanged("IsCameraPerspective");
     this.OnPropertyChanged("RotationAngle");
 }
 private void Unhook()
 {
     if (this.editingProperty == null)
     {
         return;
     }
     this.editingProperty = (PropertyReferenceProperty)null;
     this.top.OnRemoveFromCategory();
     this.left.OnRemoveFromCategory();
     this.right.OnRemoveFromCategory();
     this.bottom.OnRemoveFromCategory();
 }
        public static CustomCategorySelector GetCustomCategorySelector(PropertyReferenceProperty property)
        {
            CustomCategorySelector selectorByCategoryName;

            if ((selectorByCategoryName = CategoryFactory.GetCategorySelectorByCategoryName(CategoryLocalizationHelper.GetCanonicalCategoryName(property.CategoryName))) != null)
            {
                return(selectorByCategoryName);
            }
            if (BehaviorHelper.IsPropertyBehaviorCommand(property))
            {
                return((CustomCategorySelector) new CategoryFactory.BehaviorCommandCategorySelector());
            }
            return(new CustomCategorySelector());
        }
Exemple #8
0
        private void UpdateSelectionSet()
        {
            if (this.designerContext == null)
            {
                return;
            }
            PropertyReferenceProperty referenceProperty = this.brushCollectionView.CurrentItem as PropertyReferenceProperty;

            if (referenceProperty == null || this.designerContext.ActiveDocument == null || (this.designerContext.ActiveSceneViewModel == null || this.designerContext.ActiveDocument.IsUndoingOrRedoing))
            {
                return;
            }
            this.designerContext.ActiveSceneViewModel.PropertySelectionSet.SetSelection(referenceProperty.Reference);
            this.forcedToSelectOpacityMask = this.brushCollectionView.Count == 1 && string.Compare(((PropertyEntry)referenceProperty).get_PropertyName(), UIElement.OpacityMaskProperty.Name, StringComparison.Ordinal) == 0;
        }
Exemple #9
0
 private void Unhook()
 {
     if (this.editingProperty == null)
     {
         return;
     }
     this.editingProperty = (PropertyReferenceProperty)null;
     if (this.xProperty != null)
     {
         this.xProperty.OnRemoveFromCategory();
     }
     if (this.yProperty == null)
     {
         return;
     }
     this.yProperty.OnRemoveFromCategory();
 }
Exemple #10
0
        protected override void ModifyValue(PropertyReferenceProperty property, object valueToSet, Modification modification, int index)
        {
            BehaviorTriggerBaseNode updatedParentNode = this.GetUpdatedParentNode(property.Reference, valueToSet, modification);

            if (updatedParentNode == null)
            {
                base.ModifyValue(property, valueToSet, modification, index);
            }
            else
            {
                using (SceneEditTransaction transaction = this.CreateTransaction(property.PropertyName))
                {
                    this.ReparentActionAndCopyBehaviors(updatedParentNode);
                    base.ModifyValue(property, valueToSet, modification, index);
                    transaction.Commit();
                }
            }
        }
Exemple #11
0
 public override void OnSelectionChanged(SceneNode[] selectedObjects)
 {
     base.OnSelectionChanged(selectedObjects);
     if (selectedObjects.Length > 0)
     {
         this.designerContext = selectedObjects[0].DesignerContext;
     }
     if (this.designerContext != null && this.designerContext.ActiveSceneViewModel != null)
     {
         PropertyReference         primarySelection   = this.designerContext.ActiveSceneViewModel.PropertySelectionSet.PrimarySelection;
         PropertyReferenceProperty referenceProperty1 = (PropertyReferenceProperty)null;
         if (!this.forcedToSelectOpacityMask && primarySelection != null)
         {
             using (IEnumerator <PropertyEntry> enumerator = this.BasicProperties.GetEnumerator())
             {
                 while (((IEnumerator)enumerator).MoveNext())
                 {
                     PropertyReferenceProperty referenceProperty2 = (PropertyReferenceProperty)enumerator.Current;
                     if (string.Compare(((PropertyEntry)referenceProperty2).get_PropertyName(), primarySelection.ShortPath, StringComparison.Ordinal) == 0)
                     {
                         referenceProperty1 = referenceProperty2;
                         break;
                     }
                 }
             }
         }
         if (referenceProperty1 == null)
         {
             if (this.brushCollectionView.CurrentPosition == 0)
             {
                 this.UpdateSelectionSet();
             }
             else
             {
                 this.brushCollectionView.MoveCurrentToFirst();
             }
         }
         else if (referenceProperty1 != this.brushCollectionView.CurrentItem)
         {
             this.brushCollectionView.MoveCurrentTo((object)referenceProperty1);
         }
     }
     Microsoft.Expression.DesignSurface.UserInterface.PropertyInspector.BrushEditor.BrushCategory.ResetLastUsedBrushes();
 }
 private void StoryboardPickerEditor_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     this.editingValue = this.DataContext as Microsoft.Windows.Design.PropertyEditing.PropertyValue;
     if (this.editingProperty != null)
     {
         this.editingProperty.PropertyReferenceChanged -= new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnEditingPropertyChanged);
         this.editingProperty = (PropertyReferenceProperty)null;
     }
     if (this.editingValue != null)
     {
         this.editingProperty = (PropertyReferenceProperty)this.editingValue.ParentProperty;
     }
     if (this.editingProperty == null)
     {
         return;
     }
     this.editingProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnEditingPropertyChanged);
     this.Rebuild();
 }
Exemple #13
0
        private void OnDataContextChangedRebuild(object sender, DependencyPropertyChangedEventArgs e)
        {
            PropertyValue propertyValue = this.DataContext as PropertyValue;

            if (this.editingProperty != null)
            {
                this.editingProperty.PropertyReferenceChanged -= new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnEditingPropertyChanged);
                this.editingProperty = (PropertyReferenceProperty)null;
            }
            if (propertyValue != null)
            {
                this.editingProperty = (PropertyReferenceProperty)propertyValue.get_ParentProperty();
            }
            if (this.editingProperty == null)
            {
                return;
            }
            this.editingProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnEditingPropertyChanged);
            this.Rebuild();
        }
Exemple #14
0
        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);
        }
 private void UnhookEditingProperty()
 {
     if (this.editingProperty != null)
     {
         this.editingProperty.PropertyReferenceChanged -= new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnEditingPropertyChanged);
         this.editingProperty = (PropertyReferenceProperty)null;
     }
     if (this.targetNameProperty != null)
     {
         this.targetNameProperty.PropertyReferenceChanged -= new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnEditingPropertyChanged);
         this.targetNameProperty.OnRemoveFromCategory();
         this.targetNameProperty = (SceneNodeProperty)null;
     }
     if (this.targetObjectProperty == null)
     {
         return;
     }
     this.targetObjectProperty.PropertyReferenceChanged -= new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnEditingPropertyChanged);
     this.targetObjectProperty.OnRemoveFromCategory();
     this.targetObjectProperty = (SceneNodeProperty)null;
 }
Exemple #16
0
        private void OnOpenDialogWindow(object sender, ExecutedRoutedEventArgs eventArgs)
        {
            PropertyReferenceProperty referenceProperty = (PropertyReferenceProperty)PropertyEditingHelper.GetEditedProperty(eventArgs.OriginalSource, eventArgs.Parameter);
            DataTemplate dialogEditorTemplate           = PropertyEditingHelper.GetDialogEditorTemplate((PropertyEntry)referenceProperty);

            if (dialogEditorTemplate == null)
            {
                return;
            }
            Dialog dialog    = (Dialog) new DialogValueEditorHost(referenceProperty.get_PropertyValue(), dialogEditorTemplate);
            int    remaining = 0;
            SceneEditTransaction sceneEditTransaction = (SceneEditTransaction)null;

            if (this.ActiveDocument != null)
            {
                this.CommitOutstandingTransactions(0);
                sceneEditTransaction = this.ActiveDocument.CreateEditTransaction(string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.DialogValueEditorUndoDescription, new object[1]
                {
                    (object)referenceProperty.get_DisplayName()
                }));
                this.editTransactions.Push(sceneEditTransaction);
                remaining = this.editTransactions.Count;
            }
            bool?nullable = dialog.ShowDialog();

            if (this.ActiveDocument != null)
            {
                this.CommitOutstandingTransactions(remaining);
                if (nullable.HasValue && nullable.Value)
                {
                    sceneEditTransaction.Commit();
                }
                else
                {
                    sceneEditTransaction.Cancel();
                }
                this.editTransactions.Pop();
            }
            eventArgs.Handled = true;
        }
Exemple #17
0
 protected override void ModifyValue(PropertyReferenceProperty property, object valueToSet, Modification modification, int index)
 {
     if (modification == Modification.InsertValue)
     {
         property.Reference.Insert(this.localValue, index, valueToSet);
     }
     else if (modification == Modification.ClearValue)
     {
         property.Reference.ClearValue(this.localValue);
     }
     else if (modification == Modification.RemoveValue)
     {
         property.Reference.RemoveAt(this.localValue, index);
     }
     else
     {
         if (modification != Modification.SetValue)
         {
             return;
         }
         property.Reference.SetValue(this.localValue, valueToSet);
     }
 }
 protected override void ModifyValue(PropertyReferenceProperty property, object valueToSet, Modification modification, int index)
 {
     if (property.Reference[0] == this.targetStep && property.Reference.Count > 1 && !(valueToSet is DocumentNode))
     {
         object obj = this.GetValue((IPropertyId)this.targetStep);
         if (obj == null && PlatformTypes.Transform.IsAssignableFrom((ITypeId)this.redirectedProperty.PropertyType))
         {
             obj = new CanonicalTransform().GetPlatformTransform(this.ProjectContext.Platform.GeometryHelper);
         }
         if (modification == Modification.InsertValue)
         {
             obj = property.Reference.PartialAdd(obj, index, valueToSet, 1, property.Reference.Count - 1);
         }
         else if (modification == Modification.SetValue)
         {
             obj = property.Reference.PartialSetValue(obj, valueToSet, 1, property.Reference.Count - 1);
         }
         else if (modification == Modification.ClearValue)
         {
             property.Reference.PartialClearValue(obj, 1, property.Reference.Count - 1);
         }
         else if (modification == Modification.RemoveValue)
         {
             obj = property.Reference.PartialRemoveAt(obj, 1, property.Reference.Count - 1, index);
         }
         base.ModifyValue((PropertyReferenceProperty)this.TargetProperty, obj, Modification.SetValue, -1);
     }
     else
     {
         if (valueToSet != null && valueToSet.GetType().IsPrimitive)
         {
             valueToSet = (object)valueToSet.ToString();
         }
         base.ModifyValue(property, valueToSet, modification, index);
     }
 }
Exemple #19
0
 protected abstract void ModifyValue(PropertyReferenceProperty property, object valueToSet, Modification modification, int index);
 public PropertyReferencePropertyValue(PropertyReferenceProperty property)
     : base((PropertyEntry)property)
 {
     this.property = property;
     this.property.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnPropertyReferenceChanged);
 }
Exemple #21
0
 public object GetValue(PropertyReferenceProperty property, PropertyReference.GetValueFlags getValueFlags)
 {
     return(this.GetValue(property.Reference, getValueFlags));
 }
Exemple #22
0
 public void ClearValue(PropertyReferenceProperty property)
 {
     this.ModifyValue(property, null, Modification.ClearValue, -1);
 }
Exemple #23
0
        protected override void ModifyValue(PropertyReferenceProperty property, object valueToSet, Modification modification, int index)
        {
            if (this.ViewModel == null)
            {
                return;
            }
            string description = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.PropertyChangeUndoDescription, new object[1]
            {
                (object)((PropertyEntry)property).get_PropertyName()
            });

            if (!this.ViewModel.DefaultView.Document.IsEditable)
            {
                return;
            }
            using (SceneEditTransaction editTransaction = this.ViewModel.CreateEditTransaction(description, false, SceneEditTransactionType.NestedInAutoClosing))
            {
                try
                {
                    foreach (SceneNode sceneNode1 in this.Objects)
                    {
                        PropertyReference propertyReference1 = SceneNodeObjectSet.FilterProperty(sceneNode1, property.Reference);
                        if (propertyReference1 != null)
                        {
                            SceneNode sceneNode2 = sceneNode1;
                            if (this.ShouldAllowAnimation)
                            {
                                SceneNode         ancestor           = (SceneNode)null;
                                PropertyReference propertyReference2 = propertyReference1;
                                if (this.FindAncestor(sceneNode1, out ancestor, ref propertyReference2, new Predicate <SceneNode>(SceneNodeObjectSetBase.IsAnimationParent)))
                                {
                                    sceneNode2         = ancestor;
                                    propertyReference1 = propertyReference2;
                                }
                            }
                            using (SceneNode.DisableEnsureTransform(PlatformTypes.TransformGroup.IsAssignableFrom((ITypeId)propertyReference1.LastStep.DeclaringType)))
                            {
                                if (modification == Modification.InsertValue)
                                {
                                    sceneNode2.InsertValue(propertyReference1, index, valueToSet);
                                }
                                else if (modification == Modification.ClearValue)
                                {
                                    this.ClearAnimations(sceneNode2, propertyReference1);
                                    sceneNode2.ClearValue(propertyReference1);
                                }
                                else if (modification == Modification.RemoveValue)
                                {
                                    SceneElement element = sceneNode2.GetLocalValueAsSceneNode(propertyReference1).GetChildren()[index] as SceneElement;
                                    if (element != null)
                                    {
                                        element.ViewModel.AnimationEditor.DeleteAllAnimationsInSubtree(element);
                                    }
                                    sceneNode2.RemoveValueAt(propertyReference1, index);
                                }
                                else if (modification == Modification.SetValue)
                                {
                                    this.ClearAnimations(sceneNode2, propertyReference1);
                                    using (LayoutRoundingHelper.IsUseLayoutRoundingProperty(sceneNode2, (IProperty)propertyReference1.LastStep) ? sceneNode2.ViewModel.ForceDefaultSetValue() : (IDisposable)null)
                                        sceneNode2.SetValue(propertyReference1, valueToSet);
                                }
                                LayoutRoundingHelper.ExplicitlyChangeLayoutRounding(sceneNode2, propertyReference1);
                            }
                        }
                    }
                    editTransaction.Commit();
                }
                catch (Exception ex)
                {
                    if (editTransaction != null)
                    {
                        editTransaction.Cancel();
                    }
                    int num = (int)this.DesignerContext.MessageDisplayService.ShowMessage(new MessageBoxArgs()
                    {
                        Message = StringTable.InvalidPropertyValueErrorNoException,
                        Button  = MessageBoxButton.OK,
                        Image   = MessageBoxImage.Hand
                    });
                }
            }
            this.TransactionContext.UpdateTransaction();
        }
Exemple #24
0
 public void AddValue(PropertyReferenceProperty property, object value)
 {
     this.ModifyValue(property, value, Modification.InsertValue, -1);
 }
Exemple #25
0
        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;
            ITypeResolver      typeResolver       = (ITypeResolver)sceneNodeObjectSet.ProjectContext;

            ((PropertyEntry)this.editingProperty).get_PropertyType();
            IPropertyId propertyId1;
            IPropertyId propertyId2;

            if (PlatformTypes.Vector.IsAssignableFrom((ITypeId)this.editingProperty.PropertyTypeId))
            {
                propertyId1 = Point2DEditor.VectorXProperty;
                propertyId2 = Point2DEditor.VectorYProperty;
            }
            else if (PlatformTypes.Point.IsAssignableFrom((ITypeId)this.editingProperty.PropertyTypeId))
            {
                propertyId1 = Point2DEditor.PointXProperty;
                propertyId2 = Point2DEditor.PointYProperty;
            }
            else
            {
                Type nullableType = PlatformTypeHelper.GetNullableType(((PropertyEntry)this.editingProperty).get_PropertyType());
                if (nullableType == (Type)null)
                {
                    return;
                }
                IType type = typeResolver.GetType(nullableType);
                if (PlatformTypes.Vector.IsAssignableFrom((ITypeId)type))
                {
                    propertyId1 = Point2DEditor.VectorXProperty;
                    propertyId2 = Point2DEditor.VectorYProperty;
                }
                else
                {
                    if (!PlatformTypes.Point.IsAssignableFrom((ITypeId)type))
                    {
                        return;
                    }
                    propertyId1 = Point2DEditor.PointXProperty;
                    propertyId2 = Point2DEditor.PointYProperty;
                }
            }
            ReferenceStep step1 = (ReferenceStep)typeResolver.ResolveProperty(propertyId1);
            ReferenceStep step2 = (ReferenceStep)typeResolver.ResolveProperty(propertyId2);

            this.xProperty = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step1), step1.Attributes);
            this.yProperty = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step2), step2.Attributes);
            this.XPropertyContainer.set_PropertyEntry((PropertyEntry)this.xProperty);
            this.YPropertyContainer.set_PropertyEntry((PropertyEntry)this.yProperty);
            ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.xProperty, "X");
            ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.yProperty, "Y");
        }
 public void AddCustomProperty(PropertyReferenceProperty customProperty)
 {
     this.customProperties.Add(customProperty);
 }
Exemple #27
0
 public void RemoveValueAt(PropertyReferenceProperty property, int index)
 {
     this.ModifyValue(property, null, Modification.RemoveValue, index);
 }
Exemple #28
0
 public object GetValue(PropertyReferenceProperty property)
 {
     return(this.GetValue(property, PropertyReference.GetValueFlags.Computed));
 }
Exemple #29
0
 public void InsertValue(PropertyReferenceProperty property, int index, object value)
 {
     this.ModifyValue(property, value, Modification.InsertValue, index);
 }