Close window generated by PostableCommand

Close window generated by PostableCommand

sobon.konrad
Advocate Advocate
685 Views
3 Replies
Message 1 of 4

Close window generated by PostableCommand

sobon.konrad
Advocate
Advocate

I have posted a command "Review Warnings" that spawns a new Window dialog. Is there a way to close that window automatically and never show that to the user? 

I tried adding an event handler for DialogBoxShowing event, but it seems to never fire. Any other ideas? 

 

[Transaction(TransactionMode.Manual)]
    public class CmdExportWarnings : IExternalCommand
    {
        public virtual Result Execute(
          ExternalCommandData commandData,
          ref string message,
          ElementSet elements)
        {
            // Get application and document objects
            UIApplication uiApp = commandData.Application;
            Document doc = uiApp.ActiveUIDocument.Document;

            uiApp.Application.FailuresProcessing += new EventHandler<FailuresProcessingEventArgs>(FailureProcessing);
            uiApp.DialogBoxShowing += new EventHandler<DialogBoxShowingEventArgs>(HandleDialogBox);
            uiApp.DisplayingOptionsDialog += new EventHandler<DisplayingOptionsDialogEventArgs>(DismissWarningsWindow);

            try
            {
                RevitCommandId id = RevitCommandId.LookupPostableCommandId(PostableCommand.ReviewWarnings);
                AddInCommandBinding binding = uiApp.CreateAddInCommandBinding(id);
                uiApp.PostCommand(id);

                return Result.Succeeded;
            }
            // Catch any Exceptions and display them.
            catch (Autodesk.Revit.Exceptions.OperationCanceledException)
            {
                return Result.Cancelled;
            }
            catch (Exception x)
            {
                message = x.Message;
                return Result.Failed;
            }
        }
        public void HandleDialogBox(object sender, DialogBoxShowingEventArgs e)
        {
            int i = 0;
        }
        public void DismissWarningsWindow(object sender, DisplayingOptionsDialogEventArgs e)
        {
            int i = 0;
        }
}
}

It's this window that i need closed: 

 

Capture.PNG

0 Likes
686 Views
3 Replies
Replies (3)
Message 2 of 4

JimJia
Alumni
Alumni

Dear Konrad Sobon,

 

Please accept our sincerer apology for the delay! We had a backlog in the queue.

 

You can refer to this page below on more details about dialog suppress:

http://thebuildingcoder.typepad.com/blog/2010/08/suppress-unwanted-dialogue.html

 

As mentioned in page above, if some dialogs cannot be suppressed by Revit events, you can try window native API, please refer to this page on more details:

http://thebuildingcoder.typepad.com/blog/2009/10/dismiss-dialogue-using-windows-api.html

 


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes
Message 3 of 4

Anonymous
Not applicable

So it appears that this particular window doesn't generate an event. IT SHOULD. using native Windows API to catch that window is as dirty of a workaround as I can imagine. Can you guys log that in as a Revit improvement? 

0 Likes
Message 4 of 4

JimJia
Alumni
Alumni

Dear Konrad Sobon, 

 

I am sorry to say that there is currently no API access to this functionality.


I submitted the wish list item CF-4693 [Revit particular warning dialog doesn't raise DialogBoxShowing event - 12288516] on your behalf for the functionality you suggest, as this issue requires exploration and possibly a modification to our software. Please make a note of this number for future reference.


You are welcome to request an update on the status of this issue or to provide us with additional information at any time quoting this wish list item number.
This issue is important to me. What can I do to help?
This issue needs to be assessed by our engineering team, and prioritized against all of the other change requests that are outstanding. As a result any information that you can provide to influence this assessment will help. Please provide the following where possible:
• Impact on your application and/or your development.
• The number of users affected.
• The potential revenue impact to you.
• The potential revenue impact to Autodesk.
• Realistic timescale over which a fix would help you.
• In the case of a request for a new feature or a feature enhancement, please also provide detailed Use Cases for the workflows that this change would address.


This information is extremely important. Our engineering team have limited resources, and so must focus their efforts on the highest impact Change Requests. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes