private void toolStripMenuItemEditBuildConcepts_Click(object sender, EventArgs e)
{
DocTemplateDefinition docTemplatePset = this.m_project.GetTemplate(new Guid("f74255a6-0c0e-4f31-84ad-24981db62461"));
// also check for new template additions
DocTemplateDefinition docTemplatePropertyReference = this.m_project.GetTemplate(new Guid("e20bc116-889b-46cc-b193-31b3e2376a8e"));
if (docTemplatePset == null || docTemplatePropertyReference == null)
{
// import it
string filepath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\defaults.mvdxml";
this.ImportMVD(filepath);
docTemplatePset = this.m_project.GetTemplate(new Guid("f74255a6-0c0e-4f31-84ad-24981db62461"));
if(docTemplatePset == null)
{
MessageBox.Show(this, "The required file information is missing. You may need to re-download the application from www.buildingsmart-tech.org.");
return;
}
}
// select property sets within dialog
DocConceptRoot docRoot = null;
DocEntity docEntity = null; // all properties
if(this.treeView.SelectedNode.Tag is DocConceptRoot)
{
docRoot = (DocConceptRoot)this.treeView.SelectedNode.Tag;
docEntity = docRoot.ApplicableEntity;
using (FormSelectProperty form = new FormSelectProperty(docEntity, this.m_project, true))
{
if (form.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
{
this.BuildConceptForPropertySets(docRoot, docTemplatePset, form.IncludedPropertySets);
}
}
}
else if (this.treeView.SelectedNode.Tag is DocModelView)
{
// all entities
DocModelView docView = (DocModelView)this.treeView.SelectedNode.Tag;
foreach (DocConceptRoot docEachRoot in docView.ConceptRoots)
{
docEntity = docEachRoot.ApplicableEntity;
// find all property sets directly linked to object
List<DocPropertySet> psets = new List<DocPropertySet>();
foreach(DocSection docSection in this.m_project.Sections)
{
foreach(DocSchema docSchema in docSection.Schemas)
{
foreach(DocPropertySet docPset in docSchema.PropertySets)
{
if ((docPset.PropertySetType == "PSET_OCCURRENCEDRIVEN" ||
docPset.PropertySetType == "PSET_TYPEDRIVENOVERRIDE") &&
!String.IsNullOrEmpty(docPset.ApplicableType) && docPset.ApplicableType.Equals(docEntity.Name))
{
psets.Add(docPset);
}
}
}
}
this.BuildConceptForPropertySets(docEachRoot, docTemplatePset, psets.ToArray());
}
}
}