I've spent days trying to get a button on a Windows Form to call a function to open the shared parameters file. Looked through almost all of the Samples and have learned a lot, but I am missing something obvious. Maybe someone will know what it is. Any thoughts would be appreciated. Probably should have asked for ideas sooner.
My Windows Form is initialized and data collected on the with Click.
private void selectWalls_Click(object sender, EventArgs e)
{
SetWallParams();
}
public void SetWallParams()
{
// Routine enters ok, BUT with next declaration, fails.
Autodesk.Revit.Application app = revitData.Application;
// Revit gives an unhandled exception here. I have not declared properly, but where and how, because I have to now execute in Revit.
// Never get here. If I make this separate ExternalCommand works fine, but want to call it from WindowsForm.
Document doc = revitData.Application.ActiveDocument;
// Wall Parameters file
DefinitionFile dDWallParamsFile = LocWallParamsFile(app); // Need to pass Revit app here, hence declaration about.
// This function works from here.
if (null == dDWallParamsFile)
{
}