public static void RegisterEditor(PropertyEditorBase editor)
        {
            editor.NullCheck("editor");

            lock (_GlobalPropertyEditors)
            {
                _GlobalPropertyEditors[editor.EditorKey] = editor;
            }
        }
Beispiel #2
0
 void Page_LoadComplete(object sender, EventArgs e)
 {
     foreach (PropertyValue prop in this.Properties)
     {
         if (prop.Definition.EditorKey.IsNotEmpty())
         {
             PropertyEditorHelper.AllEditors.ContainsKey(prop.Definition.EditorKey).FalseThrow("不能找到预定义好的属性编辑器{0}", prop.Definition.EditorKey);
             PropertyEditorBase propEditor = PropertyEditorHelper.AllEditors[prop.Definition.EditorKey];
             propEditor.SetControlsPropertyDefineFromEditorParams(prop.Definition);
         }
     }
 }
        void Page_LoadComplete(object sender, EventArgs e)
        {
            foreach (PropertyValue prop in this.Properties)
            {
                if (prop.Definition.EditorKey.IsNotEmpty())
                {
                    PropertyEditorBase propEditor = PropertyEditorHelper.AllEditors[prop.Definition.EditorKey];
                    propEditor.SetControlsPropertyDefineFromEditorParams(prop.Definition);

                    //if (prop.Definition.EditorParams.IsNotEmpty() && Regex.IsMatch(prop.Definition.EditorParams, @"\{[^{}]*}") == true)
                    //{
                    //    EditorParamsDefine paraDefine = JSONSerializerExecute.Deserialize<EditorParamsDefine>(prop.Definition.EditorParams);

                    //    //try
                    //    //{
                    //    //    paraDefine = JSONSerializerExecute.Deserialize<EditorParamsDefine>(prop.Definition.EditorParams);
                    //    //}
                    //    //catch (Exception)
                    //    //{
                    //    //    flag = false;
                    //    //}

                    //    if (paraDefine.ServerControlProperties.Count > 0)
                    //    {

                    //        if (paraDefine.CloneControlID.IsNullOrEmpty())
                    //            paraDefine.CloneControlID = propEditor.DefaultCloneControlName();

                    //        if (propEditor.IsCloneControlEditor)
                    //        {
                    //            if (propEditor.ControlsPropertyDefine.ContainsKey(paraDefine.CloneControlID))
                    //            {
                    //                propEditor.ControlsPropertyDefine[paraDefine.CloneControlID].ControlPropertyDefineList = paraDefine.ServerControlProperties;
                    //            }
                    //            else
                    //            {
                    //                propEditor.ControlsPropertyDefine.Add(new ControlPropertyDefineWrapper() { ControlID = paraDefine.CloneControlID, ControlPropertyDefineList = paraDefine.ServerControlProperties });
                    //            }

                    //            //Control cloneControl = propEditor.CreateDefalutControl();
                    //            //if (cloneControl == null) return;
                    //            //cloneControl.ID = paraDefine.CloneControlID;
                    //            //propEditor.AddCloneControl(cloneControl);
                    //            //propEditor.InitCloneControlProperties(paraDefine.CloneControlID, paraDefine.ServerControlProperties);
                    //        }
                    //    }
                    //}
                }
            }
        }
        private static Dictionary <string, PropertyEditorBase> GetAllEditors()
        {
            Dictionary <string, PropertyEditorBase> result = new Dictionary <string, PropertyEditorBase>();

            lock (_GlobalPropertyEditors)
            {
                _GlobalPropertyEditors.ForEach(kp => result.Add(kp.Key, kp.Value));
            }

            TypeConfigurationCollection editorTypes = PropertyEditorSettings.GetConfig().Editors;

            foreach (TypeConfigurationElement typeElem in editorTypes)
            {
                PropertyEditorBase editor = (PropertyEditorBase)typeElem.CreateInstance();

                if (result.ContainsKey(editor.EditorKey) == false)
                {
                    result.Add(editor.EditorKey, editor);
                }
            }

            return(result);
        }