private bool AddParameters()
{
Document doc = m_app.ActiveUIDocument.Document;
if (null == doc)
{
MessageBox.Show("There's no available document.");
return false;
}
if (!doc.IsFamilyDocument)
{
MessageBox.Show("The active document is not a family document.");
return false;
}
ParameterAssigner pa = new ParameterAssigner(m_app.Application, doc);
// the parameters to be added are defined and recorded in a text file, read them from that file and load to memory
bool succeeded = pa.LoadSharedParameterFile();
if (!succeeded)
{
return false;
}
Transaction t = new Transaction(doc, "Bind Shared Parameters");
t.Start();
succeeded = pa.BindSharedParameters();
if (succeeded)
{
t.Commit();
return true;
}
else
{
t.RollBack();
return false;
}
}