Example #1
0
 protected override void OnInit(EventArgs e)
 {
     this.Page.LoadComplete      += new EventHandler(Page_LoadComplete);
     this.Page.PreRenderComplete += new EventHandler(Page_PreRenderComplete);
     PropertyEditorHelper.AttachToPage(this.Page);
     base.OnInit(e);
 }
Example #2
0
        public PropertyEditorControlBase()
            : base(true, HtmlTextWriterTag.Div)
        {
            PropertyEditorHelper.AttachToPage(WebUtility.GetCurrentPage());

            JSONSerializerExecute.RegisterConverter(typeof(PropertyValueConverter));
            JSONSerializerExecute.RegisterConverter(typeof(EnumItemPropertyDescriptionConverter));
            JSONSerializerExecute.RegisterConverter(typeof(PropertyValidatorParameterDescriptorConverter));
            JSONSerializerExecute.RegisterConverter(typeof(PropertyValidatorDescriptorConverter));
            JSONSerializerExecute.RegisterConverter(typeof(EditorParamsDefineConverter));
            JSONSerializerExecute.RegisterConverter(typeof(ControlPropertyDefineConverter));
            //JSONSerializerExecute.RegisterConverter(typeof(ClientVdtDataConverter));
        }
        protected internal override void OnPagePreRender(Page page)
        {
            if (page.Form != null)
            {
                HtmlGenericControl div = new HtmlGenericControl() { EnableViewState = false };

                div.Style["display"] = "none";

                DeluxeDateTime deluxeDateTimeControl = new DeluxeDateTime() { ID = "DateTimePropertyEditor_DeluxeDateTime", EnableViewState = false };

                div.Controls.Add(deluxeDateTimeControl);

                PropertyEditorHelper.EnsureContainer(page).Controls.Add(div);
            }
        }
Example #4
0
        private List <EnumTypePropertyDescription> CollectEnumDescriptions()
        {
            Dictionary <string, EnumTypePropertyDescription> enumDespDict = new Dictionary <string, EnumTypePropertyDescription>();

            foreach (string enumParams in PredefinedEnumTypes)
            {
                EnumTypePropertyDescription etpd = EnumTypePropertyDescription.FromEnumTypeName(enumParams);

                if (etpd != null)
                {
                    enumDespDict.Add(etpd.EnumTypeName, etpd);
                }
            }

            foreach (PropertyValue pv in this.Properties)
            {
                if (pv.Definition.DataType == PropertyDataType.Enum && pv.Definition.EditorParams.IsNotEmpty())
                {
                    string editorParamName = pv.Definition.EditorParams;
                    if (Regex.IsMatch(pv.Definition.EditorParams, @"\{[^{}]*}") == true)
                    {
                        try
                        {
                            EditorParamsDefine editorParams = JSONSerializerExecute.Deserialize <EditorParamsDefine>(pv.Definition.EditorParams);
                            editorParamName = editorParams.EnumTypeName;
                            //将配置文件里的数据源转换成下拉列表数据源
                            if (editorParams.ContainsKey("dropDownDataSourceID") == true)
                            {
                                string sourceID = editorParams["dropDownDataSourceID"];
                                if (PropertyEditorHelper.AllDropdownPropertyDataSource.ContainsKey(sourceID) == true)
                                {
                                    EnumTypePropertyDescription etpd = PropertyEditorHelper.GenerateEnumTypePropertyDescription(PropertyEditorHelper.AllDropdownPropertyDataSource[sourceID]);
                                    if (etpd != null)
                                    {
                                        enumDespDict.Add(etpd.EnumTypeName, etpd);
                                    }
                                }
                            }
                        }
                        catch (Exception)
                        {   //这里吃掉异常,主要原因是兼容老已上线的流程配置文件
                            editorParamName = pv.Definition.EditorParams;
                        }
                    }

                    if (editorParamName.IsNotEmpty())
                    {
                        if (enumDespDict.ContainsKey(editorParamName) == false)
                        {
                            EnumTypePropertyDescription etpd = EnumTypePropertyDescription.FromEnumTypeName(editorParamName);

                            if (etpd != null)
                            {
                                enumDespDict.Add(etpd.EnumTypeName, etpd);
                            }
                        }
                    }
                }
            }

            List <EnumTypePropertyDescription> result = new List <EnumTypePropertyDescription>();

            foreach (KeyValuePair <string, EnumTypePropertyDescription> kp in enumDespDict)
            {
                result.Add(kp.Value);
            }

            return(result);
        }
 protected Control GetControlsContainerInPage(Page page)
 {
     return PropertyEditorHelper.EnsureContainer(page);
 }