Skip to content

Revit Package to check if the UI is busy.

License

Notifications You must be signed in to change notification settings

ricaun-io/ricaun.Revit.UI.Busy

Repository files navigation

ricaun.Revit.UI.Busy

Revit 2017 Visual Studio 2022 Nuke License MIT Build nuget

ricaun.Revit.UI.Busy

ricaun.Revit.UI.Busy package provides a static control to monitor the busy state of Revit UI using the Idling event.

This project was generated by the ricaun.AppLoader Revit plugin.

RevitBusyControl

RevitBusyControl is a static control to monitor the busy state of Revit UI using the Idling event, this class need to be initialized.

Initialize

Static initialization of the ricaun.Revit.UI.Busy control.

UIControlledApplication application;
RevitBusyControl.Initialize(application);

RevitBusyService

The RevitBusyService class is available in the static Control property.

RevitBusyService revitBusyService = RevitBusyControl.Control;

IsRevitBusy

To check if Revit is busy, use the IsRevitBusy property.

bool isRevitBuzy = RevitBusyControl.Control.IsRevitBusy;

Binding in wpf

To use binding with the static RevitBusyControl is needed to reference the assembly ricaun.Revit.UI.Busy or using the http://schemas.revit.busy.com/2024/xaml/presentation xmlns.

xmlns:busy="http://schemas.revit.busy.com/2024/xaml/presentation"

The IsRevitBusy property can be used in the binding using the static Control with the RevitBusyService.

{Binding IsRevitBusy, Source={x:Static busy:RevitBusyControl.Control}}

RevitBusyService

The RevitBusyService class provides a service to manage the busy state of Revit using the Idling event.

UIControlledApplication application;
RevitBusyService revitBusyService = new RevitBusyService(application);

The RevitBusyService need to be disposed to clear the Idling event.

revitBusyService.Dispose();

The IsRevitBusy property can be used to check if Revit is busy.

bool isRevitBuzy = revitBusyService.IsRevitBusy;

The INotifyPropertyChanged is available in the RevitBusyService class.

revitBusyService.PropertyChanged += (sender, e) =>
{
	if (e.PropertyName == nameof(revitBusyService.IsRevitBusy))
	{
		// Do something
	}
};

The SetInterval method can be used to set the interval between checks; by default, the value is 1000 milliseconds.

revitBusyService.SetInterval(1000);

License

This project is licensed under the MIT License.


Do you like this project? Please star this project on GitHub!