Esempio n. 1
0
 private void UpdateFromDataContext()
 {
     this.Unhook();
     Microsoft.Windows.Design.PropertyEditing.PropertyValue propertyValue = this.DataContext as Microsoft.Windows.Design.PropertyEditing.PropertyValue;
     if (propertyValue != null)
     {
         this.easingFunctionProperty = propertyValue.ParentProperty as SceneNodeProperty;
         if (this.easingFunctionProperty.SceneNodeObjectSet.Document == null || this.easingFunctionProperty.SceneNodeObjectSet.RepresentativeSceneNode == null)
         {
             this.easingFunctionProperty        = (SceneNodeProperty)null;
             this.propertyHelper.ActiveDocument = (SceneDocument)null;
         }
         else
         {
             if (this.designerContext == null)
             {
                 this.designerContext = this.easingFunctionProperty.SceneNodeObjectSet.DesignerContext;
             }
             this.ActiveProjectContext          = this.easingFunctionProperty.SceneNodeObjectSet.ProjectContext;
             this.propertyHelper.ActiveDocument = this.easingFunctionProperty.SceneNodeObjectSet.Document;
             this.easingFunctionProperty.RemoveFromCategoryWhenDisassociated = true;
             this.easingFunctionProperty.PropertyReferenceChanged           += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.easingFunctionProperty_PropertyReferenceChanged);
             this.Rebuild();
         }
     }
     else
     {
         this.easingFunctionProperty        = (SceneNodeProperty)null;
         this.propertyHelper.ActiveDocument = (SceneDocument)null;
     }
 }
Esempio n. 2
0
        private void UpdateHandlers(Microsoft.Windows.Design.PropertyEditing.PropertyValue oldPropertyValue, Microsoft.Windows.Design.PropertyEditing.PropertyValue newPropertyValue)
        {
            if (oldPropertyValue != null)
            {
                SceneNodeProperty sceneNodeProperty = oldPropertyValue.ParentProperty as SceneNodeProperty;
                if (sceneNodeProperty != null)
                {
                    sceneNodeProperty.PropertyReferenceChanged -= new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnPropertyPropertyReferenceChanged);
                    sceneNodeProperty.PropertyChanged          -= new PropertyChangedEventHandler(this.OnPropertyPropertyChanged);
                    this.ChangeActiveEditMode(PropertyContainerEditMode.Inline);
                }
            }
            if (newPropertyValue == null)
            {
                return;
            }
            SceneNodeProperty sceneNodeProperty1 = newPropertyValue.ParentProperty as SceneNodeProperty;

            if (sceneNodeProperty1 == null)
            {
                return;
            }
            sceneNodeProperty1.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnPropertyPropertyReferenceChanged);
            sceneNodeProperty1.PropertyChanged          += new PropertyChangedEventHandler(this.OnPropertyPropertyChanged);
        }
Esempio n. 3
0
 private void UpdateFromDataContext()
 {
     this.EditingProperty = (SceneNodeProperty)null;
     Microsoft.Windows.Design.PropertyEditing.PropertyValue propertyValue = this.DataContext as Microsoft.Windows.Design.PropertyEditing.PropertyValue;
     if (propertyValue != null)
     {
         this.EditingProperty = propertyValue.ParentProperty as SceneNodeProperty;
         if (this.EditingProperty == null || this.EditingProperty.SceneNodeObjectSet.Document == null)
         {
             this.EditingProperty = (SceneNodeProperty)null;
             this.propertyHelper.ActiveDocument = (SceneDocument)null;
         }
         else
         {
             if (this.designerContext == null)
             {
                 this.designerContext = this.EditingProperty.SceneNodeObjectSet.DesignerContext;
                 ((AssetLibrary)this.designerContext.AssetLibrary).OnOpen();
                 ((AssetLibrary)this.designerContext.AssetLibrary).AssetLibraryChanged += new Action <AssetLibraryDamages>(this.TransitionEffectPickerEditor_AssetLibraryChanged);
             }
             this.ActiveProjectContext          = this.EditingProperty.SceneNodeObjectSet.ProjectContext;
             this.propertyHelper.ActiveDocument = this.EditingProperty.SceneNodeObjectSet.Document;
             this.EditingProperty.Recache();
             this.Rebuild();
         }
     }
     else
     {
         this.EditingProperty = (SceneNodeProperty)null;
         this.propertyHelper.ActiveDocument = (SceneDocument)null;
     }
 }
Esempio n. 4
0
        private static void PropertyValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            ObjectEditor objectEditor = (ObjectEditor)sender;

            Microsoft.Windows.Design.PropertyEditing.PropertyValue newPropertyValue = (Microsoft.Windows.Design.PropertyEditing.PropertyValue)e.NewValue;
            Microsoft.Windows.Design.PropertyEditing.PropertyValue oldPropertyValue = (Microsoft.Windows.Design.PropertyEditing.PropertyValue)e.OldValue;
            objectEditor.UpdateHandlers(oldPropertyValue, newPropertyValue);
            objectEditor.Recache();
        }
Esempio n. 5
0
 private void KeySplineEditor_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     this.Unhook();
     Microsoft.Windows.Design.PropertyEditing.PropertyValue propertyValue = e.NewValue as Microsoft.Windows.Design.PropertyEditing.PropertyValue;
     if (propertyValue == null)
     {
         return;
     }
     this.keySplineProperty = propertyValue.ParentProperty as SceneNodeProperty;
     this.Rebuild();
 }
        public override void OnRebuildComplete(Microsoft.Windows.Design.PropertyEditing.PropertyValue activePropertyValue)
        {
            if (this.transactionHelper != null)
            {
                this.transactionHelper.CommitOutstandingTransactions(0);
            }
            if (this.sceneNodePropertyLookup != null)
            {
                this.sceneNodePropertyLookup.ClearProperties();
                this.sceneNodePropertyLookup.Unhook();
                this.sceneNodePropertyLookup = (SceneNodePropertyLookup)null;
            }
            if (activePropertyValue == null)
            {
                return;
            }
            SceneNodeProperty sceneNodeProperty = (SceneNodeProperty)activePropertyValue.ParentProperty;

            this.sceneNodePropertyLookup = new SceneNodePropertyLookup(sceneNodeProperty.SceneNodeObjectSet, sceneNodeProperty.Reference);
            foreach (PropertyEntry propertyEntry in activePropertyValue.SubProperties)
            {
                SceneNodeProperty property = propertyEntry as SceneNodeProperty;
                if (property != null)
                {
                    this.sceneNodePropertyLookup.AddProperty(property.Reference, property);
                }
            }
            bool         isMixed;
            DocumentNode valueAsDocumentNode = sceneNodeProperty.GetLocalValueAsDocumentNode(true, out isMixed);

            SceneNode[] selectedObjects;
            if (valueAsDocumentNode != null)
            {
                selectedObjects = new SceneNode[1]
                {
                    sceneNodeProperty.SceneNodeObjectSet.ViewModel.GetSceneNode(valueAsDocumentNode)
                }
            }
            ;
            else
            {
                selectedObjects = new SceneNode[0];
            }
            foreach (CategoryBase categoryBase in (IEnumerable <CategoryBase>) this.Categories)
            {
                SceneNodeCategory sceneNodeCategory = categoryBase as SceneNodeCategory;
                if (sceneNodeCategory != null)
                {
                    sceneNodeCategory.OnSelectionChanged(selectedObjects);
                }
            }
        }
Esempio n. 7
0
 public ResourceEditorControl(DesignerContext designerContext, SceneNodeProperty editingProperty)
 {
     this.designerContext   = designerContext;
     this.editingProperty   = editingProperty;
     this.resourceModel     = this.BuildResourceModelFromPropertyReference();
     this.editingValue      = this.resourceModel.EditorValue;
     this.transactionHelper = new PropertyEditingHelper(this.resourceModel.Document, (UIElement)this);
     this.DataContext       = (object)this;
     this.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.FinishEditing, new ExecutedRoutedEventHandler(this.OnFinishEditing)));
     PropertyInspectorHelper.SetOwningPropertyInspectorModel((DependencyObject)this, (IPropertyInspector)this);
     PropertyInspectorHelper.SetOwningPropertyInspectorElement((DependencyObject)this, (UIElement)this);
     this.InitializeComponent();
 }
Esempio n. 8
0
 private void ObjectEditorView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     Microsoft.Windows.Design.PropertyEditing.PropertyValue propertyValue1 = (Microsoft.Windows.Design.PropertyEditing.PropertyValue)e.OldValue;
     Microsoft.Windows.Design.PropertyEditing.PropertyValue propertyValue2 = (Microsoft.Windows.Design.PropertyEditing.PropertyValue)e.NewValue;
     if (propertyValue1 != null)
     {
         propertyValue1.RootValueChanged -= new EventHandler(this.PropertyRootValueChanged);
     }
     if (propertyValue2 == null)
     {
         return;
     }
     propertyValue2.RootValueChanged += new EventHandler(this.PropertyRootValueChanged);
 }
Esempio n. 9
0
            public override void ShowDialog(Microsoft.Windows.Design.PropertyEditing.PropertyValue propertyValue, IInputElement commandSource)
            {
                this.activeDialog = (Dialog) new DialogValueEditorHost(propertyValue, this.template);
                ValueEditorUtils.SetHandlesCommitKeys((DependencyObject)this.activeDialog, true);
                Type   genericCollectionType = CollectionAdapterDescription.GetGenericCollectionType(propertyValue.ParentProperty.PropertyType);
                string str = "";

                if (genericCollectionType != (Type)null)
                {
                    str = genericCollectionType.Name + " ";
                }
                this.activeDialog.Title = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.CollectionEditorDialogTitle, new object[2]
                {
                    (object)str,
                    (object)propertyValue.ParentProperty.PropertyName
                });
                this.activeDialog.ResizeMode    = ResizeMode.CanResize;
                this.activeDialog.Width         = 600.0;
                this.activeDialog.Height        = 600.0;
                this.activeDialog.SizeToContent = SizeToContent.Manual;
                this.activeDialog.CommandBindings.Add(new CommandBinding((ICommand)PropertyValueEditorCommands.FinishEditing, new ExecutedRoutedEventHandler(this.OnPropertyValueFinishEditingCommand)));
                PropertyValueEditorCommands.BeginTransaction.Execute((object)new PropertyTransactionParameters()
                {
                    TransactionDescription = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.PropertyChangeUndoDescription, new object[1]
                    {
                        (object)propertyValue.ParentProperty.PropertyName
                    }),
                    TransactionType = SceneEditTransactionType.Normal
                }, commandSource);
                bool?nullable = new bool?();

                try
                {
                    nullable = this.activeDialog.ShowDialog();
                }
                catch
                {
                    this.messageDisplayService.ShowError(StringTable.CollectionEditorErrorMessage);
                    this.activeDialog.Close();
                }
                if (nullable.HasValue && nullable.Value)
                {
                    PropertyValueEditorCommands.CommitTransaction.Execute((object)null, commandSource);
                }
                else
                {
                    PropertyValueEditorCommands.AbortTransaction.Execute((object)null, commandSource);
                }
            }
Esempio n. 10
0
 private void OnChildrenViewCurrentChanged(object sender, EventArgs e)
 {
     this.model.Categories.Clear();
     Microsoft.Windows.Design.PropertyEditing.PropertyValue activePropertyValue = this.childrenView.CurrentItem as Microsoft.Windows.Design.PropertyEditing.PropertyValue;
     this.removeItemCommand.IsEnabled = this.IsRemoveEnabled;
     this.moveUpCommand.IsEnabled     = this.IsMoveUpEnabled;
     this.moveDownCommand.IsEnabled   = this.IsMoveDownEnabled;
     this.primitiveEditorContent      = (object)null;
     this.primitiveEditorVisibility   = Visibility.Collapsed;
     if (activePropertyValue != null)
     {
         Type   selectedType = activePropertyValue.ParentProperty.PropertyType;
         object obj          = activePropertyValue.Value;
         if (obj != null)
         {
             selectedType = obj.GetType();
         }
         if (selectedType.IsPrimitive || selectedType == typeof(string) || activePropertyValue.SubProperties.Count == 0)
         {
             this.primitiveEditorVisibility = Visibility.Visible;
             PropertyValueEditor propertyValueEditor = activePropertyValue.ParentProperty.PropertyValueEditor;
             this.primitiveEditorContent  = (object)activePropertyValue;
             this.primitiveEditorTemplate = propertyValueEditor == null?this.TryFindResource((object)"PropertyContainerDefaultInlineTemplate") as DataTemplate : propertyValueEditor.InlineEditorTemplate;
         }
         else
         {
             foreach (PropertyEntry propertyEntry in activePropertyValue.SubProperties)
             {
                 CategoryBase orCreateCategory = this.model.FindOrCreateCategory(propertyEntry.CategoryName, selectedType);
                 if (propertyEntry.IsAdvanced)
                 {
                     orCreateCategory.AdvancedProperties.Add(propertyEntry);
                 }
                 else
                 {
                     orCreateCategory.BasicProperties.Add(propertyEntry);
                 }
             }
         }
     }
     this.OnPropertyChanged("PrimitiveEditorVisibility");
     this.OnPropertyChanged("PrimitiveEditorContent");
     this.OnPropertyChanged("PrimitiveEditorTemplate");
     this.model.OnRebuildComplete(activePropertyValue);
     this.indexToSelect = this.childrenView.CurrentPosition;
 }
Esempio n. 11
0
 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();
 }
Esempio n. 12
0
        private void Rebuild()
        {
            Microsoft.Windows.Design.PropertyEditing.PropertyValue propertyValue = this.DataContext as Microsoft.Windows.Design.PropertyEditing.PropertyValue;
            PropertyReferenceProperty referenceProperty = (PropertyReferenceProperty)null;

            if (propertyValue != null)
            {
                referenceProperty = (PropertyReferenceProperty)propertyValue.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.PropertyEntry    = (PropertyEntry)this.top;
            this.LeftPropertyContainer.PropertyEntry   = (PropertyEntry)this.left;
            this.RightPropertyContainer.PropertyEntry  = (PropertyEntry)this.right;
            this.BottomPropertyContainer.PropertyEntry = (PropertyEntry)this.bottom;
        }
Esempio n. 13
0
        private void UpdateBrushEditorFromDataContext()
        {
            Microsoft.Windows.Design.PropertyEditing.PropertyValue propertyValue = this.DataContext as Microsoft.Windows.Design.PropertyEditing.PropertyValue;
            SceneNodeProperty sceneNodeProperty = (SceneNodeProperty)null;

            if (propertyValue != null)
            {
                sceneNodeProperty = (SceneNodeProperty)propertyValue.ParentProperty;
            }
            if (sceneNodeProperty == this.editingProperty)
            {
                return;
            }
            BrushCategory.ResetLastUsedBrushes();
            this.ResetEditingProperty();
            this.editingProperty = sceneNodeProperty;
            if (this.editingProperty != null)
            {
                this.editingProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnBrushChanged);
            }
            this.OnPropertyChanged("EditingProperty");
            this.Rebuild();
        }
Esempio n. 14
0
        private void Rebuild()
        {
            Microsoft.Windows.Design.PropertyEditing.PropertyValue propertyValue = this.DataContext as Microsoft.Windows.Design.PropertyEditing.PropertyValue;
            PropertyReferenceProperty referenceProperty = (PropertyReferenceProperty)null;

            if (propertyValue != null)
            {
                referenceProperty = (PropertyReferenceProperty)propertyValue.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;
            Type        propertyType = this.editingProperty.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(this.editingProperty.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.PropertyEntry = (PropertyEntry)this.xProperty;
            this.YPropertyContainer.PropertyEntry = (PropertyEntry)this.yProperty;
            ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.xProperty, "X");
            ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.yProperty, "Y");
        }