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 && string.IsNullOrEmpty(pv.Definition.EditorParams) == false) { 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 (string.IsNullOrEmpty(editorParamName) == false) { 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); }