revit - Register events -
i'm trying register dialogboxshowing event of uicontrolledapplication. cannot use onstartup / onshutdown implementation of iexternalapplication interface. best come is...
public delegate void handeler(object sender, dialogboxshowingeventargs e); public void regesterdialogevent(uicontrolledapplication uicapp) { uiappeventhandlers1 uaeh1 = new uiappeventhandlers1(); handeler hdlr = new handeler(uiappeventhandlers1.uiappevent_dialogboxshowing_handler); uicapp.dialogboxshowing += hdlr; } but i'm getting "cannot implicitly convert type 'taskdialogevent_01.form1.handeler' 'system.eventhandler autodesk.revit.ui.events.dialogboxshowingeventargs> " error. 'uiappeventhandlers1' method has same signature handler. doing wrong , can provide example? thank you.
you want use uaeh1 instance created:
uiappeventhandlers1 uaeh1 = new uiappeventhandlers1(); uicapp.dialogboxshowing += uaeh1.uiappevent_dialogboxshowing_handler; this still weird because new'ed object.
you can't register/unregister in app class follows?
public result onstartup(uicontrolledapplication app) { app.dialogboxshowing += ondialogboxshowing; return result.succeeded; } public result onshutdown(uicontrolledapplication app) { app.dialogboxshowing -= ondialogboxshowing; return result.succeeded; } void ondialogboxshowing(object sender, dialogboxshowingeventargs args) { } handling dialogs dialogboxshowing event isn't best way in experience. recommend looking newer failures processing api.
Comments
Post a Comment