Beispiel #1
0
        public static BaseEditController GetEditController(PropertyDescriptor propertyDescriptor)
        {
            BaseEditController editController = null;
            var editorType = EditorPublic.GetEditorTypeByReflection(propertyDescriptor);

            if (editorType == null)
            {
                editController = GetEditController(propertyDescriptor.PropertyType);
            }
            else
            {
                editController = editorType.CreateInstance() as BaseEditController;
                EditorPublic.SetEditControllerToStorage(propertyDescriptor.PropertyType, editController);
            }

            return(editController);
        }
Beispiel #2
0
        /// 通用获取或创建编辑器步骤:(BaseObjectEditController中)
        /// 1. 从BaseObjectEditController中的PredefinedEditors属性中获取编辑控制器;
        /// 2. 通过类或属性的EditorTypeAttribute获取编辑控制器类型;
        /// 3. 根据类型获取默认的编辑控制器;
        /// 4. 从客户端存储中获取编辑控制器的配置;
        /// 5. 创建编辑器;
        ///
        /// 指定数据类型获取编辑器的步骤:
        /// 1. 通过类或属性的EditorTypeAttribute获取编辑控制器类型;
        /// 2. 根据类型获取默认的编辑控制器;
        /// 3. 从客户端存储中获取编辑控制器的配置;
        /// 4. 创建编辑器;
        ///
        /// 指定编辑器类型创建编辑器的步骤:
        /// 1. 从客户端存储中获取编辑控制器的配置;
        /// 3. 创建编辑器;

        public static BaseEditController GetEditController(Type objectType)
        {
            BaseEditController editController = null;
            var editorType = EditorPublic.GetEditorTypeByReflection(objectType);

            if (editorType == null)
            {
                editorType = GetDefaultEditorType(objectType);
            }

            if (editorType == null)
            {
                return(null);
            }

            editController = EditorPublic.GetEditControllerFromStorage(objectType, editorType);
            if (editController == null)
            {
                editController = editorType.CreateInstance() as BaseEditController;
                EditorPublic.SetEditControllerToStorage(objectType, editController);
            }
            return(editController);
        }