private CategoryBase CreateCategory(string name, Type selectedType)
        {
            CategoryLocalizationHelper.CategoryName canonicalCategoryName = CategoryLocalizationHelper.GetCanonicalCategoryName(name);
            CategoryBase      categoryBase        = (CategoryBase)CategoryFactory.GetCustomCategorySelector(canonicalCategoryName).CreateSceneNodeCategory(canonicalCategoryName, name, this.SceneNodeObjectSet.DesignerContext.MessageLoggingService);
            ITypeResolver     typeResolver        = (ITypeResolver)this.SceneNodeObjectSet.ProjectContext;
            CategoryEditorSet categoryEditorsList = new CategoryEditorSet();
            IType             type = typeResolver.GetType(selectedType);

            PropertyInspectorModel.GetCategoryEditors(type, categoryEditorsList, this.MessageLoggingService);
            foreach (CategoryEditor categoryEditor in categoryEditorsList.Union(CategoryEditorInstanceFactory.GetEditors((ITypeId)type, categoryBase as SceneNodeCategory)))
            {
                if (categoryEditor.TargetCategory == categoryBase.CategoryName)
                {
                    categoryBase.CategoryEditors.Add(categoryEditor);
                }
            }
            return(categoryBase);
        }
示例#2
0
        private CategoryBase CreateCategory(string name, Type selectedType)
        {
            CategoryLocalizationHelper.CategoryName canonicalCategoryName = CategoryLocalizationHelper.GetCanonicalCategoryName(name);
            CategoryBase      categoryBase        = (CategoryBase)CategoryFactory.GetCustomCategorySelector(canonicalCategoryName).CreateSceneNodeCategory(canonicalCategoryName, name, this.SceneNodeObjectSet.DesignerContext.MessageLoggingService);
            ITypeResolver     typeResolver        = (ITypeResolver)this.SceneNodeObjectSet.ProjectContext;
            CategoryEditorSet categoryEditorsList = new CategoryEditorSet();
            IType             type = typeResolver.GetType(selectedType);

            PropertyInspectorModel.GetCategoryEditors(type, categoryEditorsList, this.MessageLoggingService);
            using (IEnumerator <CategoryEditor> enumerator = categoryEditorsList.Union(CategoryEditorInstanceFactory.GetEditors((ITypeId)type, categoryBase as SceneNodeCategory)).GetEnumerator())
            {
                while (((IEnumerator)enumerator).MoveNext())
                {
                    CategoryEditor current = enumerator.Current;
                    if (current.get_TargetCategory() == categoryBase.get_CategoryName())
                    {
                        categoryBase.CategoryEditors.Add(current);
                    }
                }
            }
            return(categoryBase);
        }