How can I suppress the "Instance of linked .rvt file needs Coordination Review" dialog?

StackOverflow https://stackoverflow.com/questions/19957729

  •  30-07-2022
  •  | 
  •  

質問

I need to suppress the Instance of linked .rvt file needs Coordination Review dialog while I'm running an add-in that opens multiple models because I don't want the user to need to click through a bunch of dialogs. I've added an event handler to UIApplication.DialogBoxShowing and it checks if the dialog has HelpId == 1011 (found here) which is the dialog that I'm looking for. However, when I try the e.OverrideResult method it always seems to cancel the action. I've tried TaskDialogResult.Ok and DialogResult.Ok but both of them cancel the action.

Here is my event handler:

private void application_DialogBoxShowing(object sender, 
  DialogBoxShowingEventArgs e)
{
  if (e.HelpId == 1011)
    e.OverrideResult((int)TaskDialogResult.Ok);
}

What dialog result can I pass to make the action continue?

役に立ちましたか?

解決

Instead of using an event handler for when dialog boxes show I decided to make an event handler that ties into the UIApplication.Application.FailuresProcessing event. I found the information on the failure API from the Building Coder.

The code below will suppress all warnings.

private void Application_FailuresProcessing(object sender, 
  FailuresProcessingEventArgs e)
{
  FailuresAccessor failuresAccessor = e.GetFailuresAccessor();
  IEnumerable<FailureMessageAccessor> failureMessages =
    failuresAccessor.GetFailureMessages();

  foreach (FailureMessageAccessor failureMessage in failureMessages)
  {
    if (failureMessage.GetSeverity() == FailureSeverity.Warning)
      failuresAccessor.DeleteWarning(failureMessage)
  }

  e.SetProcessingResult(FailureProcessingResult.Continue)
}

You can add an if statement checking for failureMessage.GetFailureDefinitionId().Guid == new Guid("3d983f31-9ee3-4c3a-bed8-663b32cecec5") if you only want to suppress the specific coordination review message.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top