Recently I created and shared this package to monitor if Revit is busy doing something or not.
The code use Idling to update the IsRevitBusy propriety when the event stop triggering.
I would like to know if someone have a different approach with the same goal, to know if Revit is busy or available to run ExternalEvent.
In the past, the Revit API had IsQuiescent propriety, but it seems not thread-safe and was removed.
I kinda what something like IsQuiescent without messing with events.
Recently I created and shared this package to monitor if Revit is busy doing something or not.
The code use Idling to update the IsRevitBusy propriety when the event stop triggering.
I would like to know if someone have a different approach with the same goal, to know if Revit is busy or available to run ExternalEvent.
In the past, the Revit API had IsQuiescent propriety, but it seems not thread-safe and was removed.
I kinda what something like IsQuiescent without messing with events.
I think the Idling event is problematic, because (I believe) Revit calls it as much as possible when it is not busy, consuming a lot of computer performance. Can you explain how this test is related to the API Context Predicate approach recently suggested by @nice3point , and why you cannot use that?
I think the Idling event is problematic, because (I believe) Revit calls it as much as possible when it is not busy, consuming a lot of computer performance. Can you explain how this test is related to the API Context Predicate approach recently suggested by @nice3point , and why you cannot use that?
Revit Idling similar to System.Windows.Interop.ComponentDispatcher.ThreadIdle is called extremely often, and without trottling it significantly degrades performance. Idling should be used in very specific cases when there are really no alternatives in RevitAPI and at the same time to unsubscribe as early as possible.
Displaying revit busy indicator in modeless windows even from the UX side looks strange. But if there is a need, you can use AsyncEventHandler in combination with TaskNotifier to bind the task progress to UI.
Sample: https://github.com/MicrosoftDocs/CommunityToolkit/blob/main/docs/mvvm/ObservableObject.md
Revit Idling similar to System.Windows.Interop.ComponentDispatcher.ThreadIdle is called extremely often, and without trottling it significantly degrades performance. Idling should be used in very specific cases when there are really no alternatives in RevitAPI and at the same time to unsubscribe as early as possible.
Displaying revit busy indicator in modeless windows even from the UX side looks strange. But if there is a need, you can use AsyncEventHandler in combination with TaskNotifier to bind the task progress to UI.
Sample: https://github.com/MicrosoftDocs/CommunityToolkit/blob/main/docs/mvvm/ObservableObject.md
The code is doing the smallest thing inside the Idling event, and I would love to not use that event, but I don't know if there is a way with the requirement I have.
Could be used to make a modeless UI grey and unavailable, but is not what I'm using for.
I'm using Revit as service with my RevitTest Framework, and I need to know when Revit is available or free to be used, to make sure if I Raise the ExternalEvent the code gonna execute as soon as possible.
If any pop happen in Revit with the MessageBox.Show for example, Revit gonna be busy waiting for the user to close the message box.
How can I find the Revit availability/busy state without using Idling that basically trigger when Revit is available for user interactions.
The code is doing the smallest thing inside the Idling event, and I would love to not use that event, but I don't know if there is a way with the requirement I have.
Could be used to make a modeless UI grey and unavailable, but is not what I'm using for.
I'm using Revit as service with my RevitTest Framework, and I need to know when Revit is available or free to be used, to make sure if I Raise the ExternalEvent the code gonna execute as soon as possible.
If any pop happen in Revit with the MessageBox.Show for example, Revit gonna be busy waiting for the user to close the message box.
How can I find the Revit availability/busy state without using Idling that basically trigger when Revit is available for user interactions.
@nice3point wrote:
Should you then make this property Obsevable if you don't plan it for Binding? For tests it is enough to subscribe once and unsubscribe immediately when required. Another option is to use the ApplicationInitialized event, and run Revit in no-ui mode so you can't open any dialog. I've presented a few more options, but I don't know the intricacies of how you use this. To suppress Msbox use UiApplication.DialogBoxShowing event
Eventually, I will use that appouch to Binding the UI to prevent the user to interact with the modeless windows UI.
Suppress the UI could be an option but is not what I'm looking for, my RevitTest Framework should not change the normal behavior of Revit.
Just want to know when Revit is busy or available. Without using Idling event is hard/impossible to find that Revit state.
@nice3point wrote:
Should you then make this property Obsevable if you don't plan it for Binding? For tests it is enough to subscribe once and unsubscribe immediately when required. Another option is to use the ApplicationInitialized event, and run Revit in no-ui mode so you can't open any dialog. I've presented a few more options, but I don't know the intricacies of how you use this. To suppress Msbox use UiApplication.DialogBoxShowing event
Eventually, I will use that appouch to Binding the UI to prevent the user to interact with the modeless windows UI.
Suppress the UI could be an option but is not what I'm looking for, my RevitTest Framework should not change the normal behavior of Revit.
Just want to know when Revit is busy or available. Without using Idling event is hard/impossible to find that Revit state.
Can't find what you're looking for? Ask the community or share your knowledge.