예제 #1
0
        private static void PropertyEditor_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            FrameworkElement  frameworkElement   = (FrameworkElement)sender;
            SceneNodeCategory sceneNodeCategory1 = e.NewValue as SceneNodeCategory;

            if (sceneNodeCategory1 != null)
            {
                PropertyEntry property = frameworkElement.GetValue(SceneNodeCategory.AttachedPropertyEntryProperty) as PropertyEntry;
                if (property == null)
                {
                    return;
                }
                sceneNodeCategory1.AddAttachedProperty(property);
                frameworkElement.DataContextChanged -= new DependencyPropertyChangedEventHandler(SceneNodeCategory.PropertyEditor_DataContextChanged);
            }
            else
            {
                SceneNodeCategory sceneNodeCategory2 = e.OldValue as SceneNodeCategory;
                if (sceneNodeCategory2 == null)
                {
                    return;
                }
                PropertyEntry property = frameworkElement.GetValue(SceneNodeCategory.AttachedPropertyEntryProperty) as PropertyEntry;
                if (property == null)
                {
                    return;
                }
                sceneNodeCategory2.RemoveAttachedProperty(property);
            }
        }
        public static CategoryEditorSet GetEditors(ITypeId selectedType, SceneNodeCategory category)
        {
            CategoryEditorSet categoryEditorSet = new CategoryEditorSet();

            foreach (CategoryEditorFactory categoryEditorFactory in CategoryEditorInstanceFactory.CategoryEditorFactories)
            {
                categoryEditorSet = categoryEditorSet.Union(categoryEditorFactory.GetCategoryEditors(selectedType, category));
            }
            return(categoryEditorSet);
        }
예제 #3
0
 public CategoryOrder(SceneNodeCategory category)
 {
     this.category = category;
     this.priority = (int)category.CanonicalName;
     if (this.priority != -1)
     {
         return;
     }
     this.priority = 100;
 }
예제 #4
0
        public override void OnRebuildComplete(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.get_ParentProperty();

            this.sceneNodePropertyLookup = new SceneNodePropertyLookup(sceneNodeProperty.SceneNodeObjectSet, sceneNodeProperty.Reference);
            using (IEnumerator <PropertyEntry> enumerator = activePropertyValue.get_SubProperties().GetEnumerator())
            {
                while (((IEnumerator)enumerator).MoveNext())
                {
                    SceneNodeProperty property = enumerator.Current 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);
                }
            }
        }
예제 #5
0
        public override CategoryEditorSet GetCategoryEditors(ITypeId selectedType, SceneNodeCategory category)
        {
            CategoryEditorSet categoryEditorSet = new CategoryEditorSet();

            if (!(category is ConditionalExpressionBehaviorCategory))
            {
                return(categoryEditorSet);
            }
            categoryEditorSet.AddCategoryEditor((CategoryEditor) new ConditionalExpressionBehaviorCategoryEditor(category.CategoryName), (object)category.CategoryName);
            return(categoryEditorSet);
        }
예제 #6
0
        public override CategoryEditorSet GetCategoryEditors(ITypeId selectedType, SceneNodeCategory category)
        {
            bool flag = PlatformTypes.TextElement.IsAssignableFrom(selectedType) || PlatformTypes.Inline.IsAssignableFrom(selectedType);
            CategoryEditorSet categoryEditorSet = new CategoryEditorSet();

            if (flag || PlatformTypes.FrameworkElement.IsAssignableFrom(selectedType) || ProjectNeutralTypes.DataGridTextColumn.IsAssignableFrom(selectedType))
            {
                categoryEditorSet.AddCategoryEditor((CategoryEditor) new TextCategoryEditor());
            }
            return(categoryEditorSet);
        }
        public override CategoryEditorSet GetCategoryEditors(ITypeId selectedType, SceneNodeCategory category)
        {
            CategoryEditorSet categoryEditorSet = new CategoryEditorSet();

            if (!ProjectNeutralTypes.PathListBox.IsAssignableFrom(selectedType) && !ProjectNeutralTypes.PathPanel.IsAssignableFrom(selectedType))
            {
                return(categoryEditorSet);
            }
            categoryEditorSet.AddCategoryEditor((CategoryEditor) new PathLayoutCategoryCategoryEditor(), (object)category.CategoryName);
            return(categoryEditorSet);
        }
        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);
                }
            }
        }
        public override CategoryEditorSet GetCategoryEditors(ITypeId selectedType, SceneNodeCategory category)
        {
            CategoryEditorSet categoryEditorSet = new CategoryEditorSet();

            if (ProjectNeutralTypes.Behavior.IsAssignableFrom(selectedType))
            {
                foreach (SceneNodeProperty sceneNodeProperty in category.Properties)
                {
                    if (PlatformTypes.ICommand.IsAssignableFrom((ITypeId)sceneNodeProperty.PropertyTypeId))
                    {
                        categoryEditorSet.AddCategoryEditor((CategoryEditor) new BehaviorCommandCategoryEditor(category.CategoryName), (object)category.CategoryName);
                        categoryEditorSet.AddCategoryEditor((CategoryEditor) new BehaviorCommandAdvancedCategoryEditor(category.CategoryName), (object)category.CategoryName);
                        break;
                    }
                }
            }
            return(categoryEditorSet);
        }
예제 #10
0
        private static void AttachedPropertyEntryChanged(DependencyObject source, DependencyPropertyChangedEventArgs args)
        {
            SceneNodeCategory sceneNodeCategory = source.GetValue(FrameworkElement.DataContextProperty) as SceneNodeCategory;

            if (sceneNodeCategory != null)
            {
                if (args.OldValue != null)
                {
                    sceneNodeCategory.RemoveAttachedProperty((PropertyEntry)args.OldValue);
                }
                if (args.NewValue == null)
                {
                    return;
                }
                sceneNodeCategory.AddAttachedProperty((PropertyEntry)args.NewValue);
            }
            else
            {
                ((FrameworkElement)source).DataContextChanged += new DependencyPropertyChangedEventHandler(SceneNodeCategory.PropertyEditor_DataContextChanged);
            }
        }
예제 #11
0
        public override CategoryBase FindOrCreateCategory(string categoryName, Type selectedType)
        {
            CategoryLocalizationHelper.CategoryName canonicalCategoryName = CategoryLocalizationHelper.GetCanonicalCategoryName(categoryName);
            if (canonicalCategoryName != CategoryLocalizationHelper.CategoryName.Unknown)
            {
                categoryName = CategoryLocalizationHelper.GetLocalizedCategoryName(canonicalCategoryName);
            }
            int index = OrderedListExtensions.GenericBinarySearch <CategoryBase, CategoryLocalizationHelper.CategoryName>(this.Categories, canonicalCategoryName, (Func <CategoryLocalizationHelper.CategoryName, CategoryBase, int>)((canonicalName, category) =>
            {
                SceneNodeCategory sceneNodeCategory = (SceneNodeCategory)category;
                return(canonicalName.CompareTo((object)sceneNodeCategory.CanonicalName));
            }));

            if (index >= 0)
            {
                return(this.Categories[index]);
            }
            CategoryBase category1 = this.CreateCategory(categoryName, selectedType);

            this.Categories.Insert(~index, category1);
            return(category1);
        }
        public override CategoryEditorSet GetCategoryEditors(ITypeId selectedType, SceneNodeCategory category)
        {
            CategoryEditorSet categoryEditorSet = new CategoryEditorSet();

            if (ProjectNeutralTypes.Behavior.IsAssignableFrom(selectedType))
            {
                using (IEnumerator <PropertyEntry> enumerator = ((CategoryEntry)category).get_Properties().GetEnumerator())
                {
                    while (((IEnumerator)enumerator).MoveNext())
                    {
                        SceneNodeProperty sceneNodeProperty = (SceneNodeProperty)enumerator.Current;
                        if (PlatformTypes.ICommand.IsAssignableFrom((ITypeId)sceneNodeProperty.PropertyTypeId))
                        {
                            categoryEditorSet.AddCategoryEditor((CategoryEditor) new BehaviorCommandCategoryEditor(category.get_CategoryName()), category.get_CategoryName());
                            categoryEditorSet.AddCategoryEditor((CategoryEditor) new BehaviorCommandAdvancedCategoryEditor(category.get_CategoryName()), category.get_CategoryName());
                            break;
                        }
                    }
                }
            }
            return(categoryEditorSet);
        }
예제 #13
0
 public abstract CategoryEditorSet GetCategoryEditors(ITypeId selectedType, SceneNodeCategory category);
        public override sealed CategoryEditorSet GetCategoryEditors(ITypeId selectedType, SceneNodeCategory category)
        {
            CategoryEditorSet categoryEditorSet = new CategoryEditorSet();

            if (this.EditableType == null || this.EditableType.IsAssignableFrom(selectedType))
            {
                using (IEnumerator <CategoryEditor> enumerator = this.GetCategoryEditors().GetEnumerator())
                {
                    while (((IEnumerator)enumerator).MoveNext())
                    {
                        CategoryEditor current = enumerator.Current;
                        categoryEditorSet.AddCategoryEditor(current);
                    }
                }
            }
            return(categoryEditorSet);
        }
예제 #15
0
        public override sealed CategoryEditorSet GetCategoryEditors(ITypeId selectedType, SceneNodeCategory category)
        {
            CategoryEditorSet categoryEditorSet = new CategoryEditorSet();

            if (this.EditableType == null || this.EditableType.IsAssignableFrom(selectedType))
            {
                foreach (CategoryEditor editor in this.GetCategoryEditors())
                {
                    categoryEditorSet.AddCategoryEditor(editor);
                }
            }
            return(categoryEditorSet);
        }