Announcement

Collapse
No announcement yet.

Subscribing to Database Events - application.DocumentOpened

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Subscribing to Database Events - application.DocumentOpened

    I am following the Revit 2012 API WikiHelp Walkthrough code example for registering events.

    Code follows:

    public IExternalApplication.Result OnStartup(ControlledApplication application)
    {
    try
    {
    // Register event.
    application.DocumentOpened += new EventHandler
    <Autodesk.Revit.Events.DocumentOpenedEventArgs>(application_DocumentOpen ed);
    }
    catch (Exception)
    {
    return Autodesk.Revit.UI.Result.Failed;
    }

    return Autodesk.Revit.UI.Result.Succeeded;
    }

    I am receiving errors:
    'Autodesk.Revit.UI.UIControlledApplication' does not contain a definition for 'DocumentOpened' and no extension method 'DocumentOpened' accepting a first argument of type 'Autodesk.Revit.UI.UIControlledApplication' could be found (are you missing a using directive or an assembly reference?)

    The type or namespace name 'Events' does not exist in the namespace 'Autodesk.Revit' (are you missing an assembly reference?)


    What am I missing?

    #2
    And the answer is:

    application.ControlledApplication.DocumentOpened += new EventHandler
    <Autodesk.Revit.DB.Events.DocumentOpenedEventArgs> (application_DocumentOpened);

    Comment

    Related Topics

    Collapse

    Working...
    X