
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
See the following
I am getting a complete crash of revit when i start the addin and it gets past the call to invoke a modal dialog. I f i dont include it nothing happens at all i dont get the taskdialog showing or anything.
//main external command
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
//Get application and document objects
UIApplication uiApp = commandData.Application;
UIDocument uiDoc = uiApp.ActiveUIDocument;
Autodesk.Revit.ApplicationServices.Application app = uiApp.Application;
Autodesk.Revit.DB.Document doc = uiDoc.Document;
//calls to modal dialog
OnStartup(uiApp);
//do some stuff with postcommand
//Call to modless dialog
boiler code ....etc
}
// Implement the OnStartup method to register events when Revit starts.
public Result OnStartup(UIApplication application)
{
// Register related events
application.DialogBoxShowing +=
new EventHandler<Autodesk.Revit.UI.Events.DialogBoxShowingEventArgs>(AppDialogShowing);
TaskDialog.Show("dialog showing", "registered");
return Result.Succeeded;
}
// Implement this method to unregister the subscribed events when Revit exits.
public Result OnShutdown(UIApplication application)
{
// unregister events
application.DialogBoxShowing -=
new EventHandler<Autodesk.Revit.UI.Events.DialogBoxShowingEventArgs>(AppDialogShowing);
return Result.Succeeded;
}
// The DialogBoxShowing event handler, which allow you to
// do some work before the dialog shows
public void AppDialogShowing(object sender, DialogBoxShowingEventArgs args)
{
TaskDialog.Show("x", "xxxxx");
}//end mthd
Solved! Go to Solution.