- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I've come across an expected issue with a browser addon that I'm writing, the added essentially allows the user to open some views. This all works via a modeless form.
The addon keeps track of the active view by tracking the ViewActivated event
uiapp.ViewActivated += new EventHandler<ViewActivatedEventArgs>(my-routine);
This also works well, the issue comes when the user clicks into a different open project, different to the one that was open when the addon was started.
When the user tries to open a view, the addon uses the stored View Id to open the view, the Id does not apply in the other project and an error is generated.
I thought I could simply keep track of the project name: doc.Title; and 'refresh' my addon (by using a FilteredElementCollector to get the projects views) whenever the user clicks in my addon and the document title does not match.
This does not work as I thought, and I've noticed that the ViewActivated event only seems to apply to the project that was open and not any project, consequently, the other open project does not trigger the event the addon does not refresh and an error is generated when the user tries to open a view.
I think I need a 'user-has-clicked-into-another-open-document' event, but I can't seem to find one.
Is there any way I can detect that the current document has changed, or get the ViewActivated event to apply to all open projects?
Thanks.
Solved! Go to Solution.