pyrevitlabs / pyRevit

Rapid Application Development (RAD) Environment for Autodesk Revit®
http://wiki.pyrevitlabs.io
GNU General Public License v3.0
1.33k stars 337 forks source link

Subscribe to UIApplication.Application.ApplicationInitialized event? #1027

Closed dnenov closed 4 years ago

dnenov commented 4 years ago

Hi Ehsan,

I am testing a piece of code that adds a DockablePane. This is ideally done in the UIApplication.Application.ApplicationInitialized event, as far as I can tell.

My question is if there is a way to subscribe to the APplicationInitialized event correctly using pyRevit? From within one of the regular scripts I am trying this HOST_APP.app.ApplicationInitialized += DockablePaneRegisters but I am not getting much :/

Really appreciated!

eirannejad commented 4 years ago

Yup. Take a look at this example snippet that binds the event handler on extension startup https://github.com/eirannejad/pyRevit/blob/4319ff011c36f24b26b2394d6862e685e566f26b/extensions/pyRevitDevTools.extension/startup.py#L45

dnenov commented 4 years ago

Thank you, Ehsan.