Message 1 of 4
Close window generated by PostableCommand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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: