IfcDoc.CtlProperties.buttonPropertyDataSecondary_Click C# (CSharp) Method

buttonPropertyDataSecondary_Click() private method

private buttonPropertyDataSecondary_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void buttonPropertyDataSecondary_Click(object sender, EventArgs e)
        {
            DocProperty docTemplate = (DocProperty)this.m_target;

            DocSchema docSchema = null;
            DocPropertyEnumeration docEnum = this.m_project.FindPropertyEnumeration(docTemplate.SecondaryDataType, out docSchema);

            if (docTemplate.PropertyType == DocPropertyTemplateTypeEnum.P_ENUMERATEDVALUE)
            {
                // browse for property enumeration
                using (FormSelectPropertyEnum form = new FormSelectPropertyEnum(this.m_project, docEnum))
                {
                    if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                    {
                        if (form.Selection != null)
                        {
                            docTemplate.PrimaryDataType = "IfcLabel";
                            docTemplate.SecondaryDataType = form.Selection.Name;
                        }
                        else
                        {
                            docTemplate.PrimaryDataType = "IfcLabel";
                            docTemplate.SecondaryDataType = String.Empty;
                        }
                        this.textBoxPropertyDataPrimary.Text = docTemplate.PrimaryDataType;
                        this.textBoxPropertyDataSecondary.Text = docTemplate.SecondaryDataType;
                    }
                }
                return;
            }

            string basetypename = "IfcValue";
            DocObject docobj = null;
            DocDefinition docEntity = null;
            if (this.m_map.TryGetValue(basetypename, out docobj))
            {
                docEntity = (DocDefinition)docobj;
            }

            // get selected entity
            DocObject target = null;
            DocDefinition entity = null;
            if (docTemplate.PrimaryDataType != null && m_map.TryGetValue(docTemplate.PrimaryDataType, out target))
            {
                entity = (DocDefinition)target;
            }

            using (FormSelectEntity form = new FormSelectEntity(docEntity, entity, this.m_project, SelectDefinitionOptions.Entity | SelectDefinitionOptions.Type))
            {
                DialogResult res = form.ShowDialog(this);
                if (res == DialogResult.OK && form.SelectedEntity != null)
                {
                    docTemplate.SecondaryDataType = form.SelectedEntity.Name;
                    this.textBoxPropertyDataSecondary.Text = docTemplate.SecondaryDataType;
                }
            }
        }
CtlProperties