DialogBoxShowing Event not raised when OpenDocumentFile() shows a dialog

DialogBoxShowing Event not raised when OpenDocumentFile() shows a dialog

FlorisvdG
Advocate Advocate
815 Views
2 Replies
Message 1 of 3

DialogBoxShowing Event not raised when OpenDocumentFile() shows a dialog

FlorisvdG
Advocate
Advocate

So I've created this script, which opens and closes several files through the OpenDocumentFile() command.
Upon opening a certain file, the message below pops up.
I have tried creating a handler for it, using the following at OnApplicationInitialized():

            app = sender as Autodesk.Revit.ApplicationServices.Application;

            uiapp = new UIApplication(app);
            uiapp.DialogBoxShowing += DialogBoxShowing;

DialogBoxShowing is not raised.

I Also tried the following at OnStartup(UIControlledApplication a):
            a.ControlledApplication.ApplicationInitialized += OnApplicationInitialized;
           a.DialogBoxShowing += DialogBoxShowing;

In  neither cases a DialogBoxShowingEvent is raised.

I also tried implementing the FailuresProcessingEvent, which get's raised a lot during the loading of the file, but not when the dialog i shown.

Is there any way  (that does NOT include using OpenAndActivate() instead of OpenDocumentFile()) for me to handle this through the Revit Api? I'd rather not use a .net approach.

Thanks.

opendocumentfileError.jpg

0 Likes
Accepted solutions (1)
816 Views
2 Replies
Replies (2)
Message 2 of 3

jeremytammik
Autodesk
Autodesk
Accepted solution

I believe that all warnings and messages displayed in the type of dialogue that you show in the screen snapshot can be caught and processed by the failure handling API.

 

Please check out the warning swallower that I implemented for the StarsAutomation SDK sample and see whether that helps:

 

https://thebuildingcoder.typepad.com/blog/2018/09/swallowing-stairsautomation-warnings.html

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 3

FlorisvdG
Advocate
Advocate

Thank you Jeremy, It took some time to understand it all, (which I don't fully do yet) But I got it to work. The warning is surpressed, and the addin continues as it should.

0 Likes