- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
We find 2 examples on the SDK for modeless forms, one with external events and the other with idling. The issue with the idling event example is that the event is registered once and staying that way. I would like to register and unregister that event on demand, to prevent my code listening to all the calls of the idling event (inspired by a post from Jeremy) . So, being a newbie I have tried to make a simple call register the event outside the Revit API context with:
_cachedUiCtrApp.Idling += new EventHandler<IdlingEventArgs>(OnIdling);
And got the exception:
Invalid call to Revit API! Revit is currently not within an API context.
What do we need to implement in the non UI Revit thread to register the idling event correctly?
Solved! Go to Solution.