private void comboBoxPropertyType_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.m_loadall)
return;
DocProperty docProperty = (DocProperty)this.m_target;
// if old value was reference, then must reset to label
if (docProperty.PropertyType == DocPropertyTemplateTypeEnum.P_REFERENCEVALUE ||
String.IsNullOrEmpty(docProperty.PrimaryDataType))
{
docProperty.PrimaryDataType = "IfcLabel";
}
try
{
docProperty.PropertyType = (DocPropertyTemplateTypeEnum)Enum.Parse(typeof(DocPropertyTemplateTypeEnum), this.comboBoxPropertyType.SelectedItem.ToString());
}
catch
{
docProperty.PropertyType = DocPropertyTemplateTypeEnum.COMPLEX;
}
switch (docProperty.PropertyType)
{
case DocPropertyTemplateTypeEnum.P_SINGLEVALUE:
docProperty.SecondaryDataType = String.Empty;
break;
case DocPropertyTemplateTypeEnum.P_BOUNDEDVALUE:
docProperty.SecondaryDataType = String.Empty;
break;
case DocPropertyTemplateTypeEnum.P_LISTVALUE:
docProperty.SecondaryDataType = String.Empty;
break;
case DocPropertyTemplateTypeEnum.P_TABLEVALUE:
if(String.IsNullOrEmpty(docProperty.SecondaryDataType))
{
docProperty.SecondaryDataType = "IfcReal";
}
break;
case DocPropertyTemplateTypeEnum.P_ENUMERATEDVALUE: // add/remove enum values
docProperty.PrimaryDataType = "IfcLabel";
docProperty.SecondaryDataType = String.Empty; // must select
break;
case DocPropertyTemplateTypeEnum.P_REFERENCEVALUE:
docProperty.PrimaryDataType = "IfcTimeSeries";
docProperty.SecondaryDataType = "IfcReal";
break;
}
// update
this.LoadPropertyType();
}