Class RevitExternalHandler
Provides a way to run asyncronous taks on Revit's main thread
Inheritance
System.Object
RevitExternalHandler
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Onbox.Revit.V8.Async
Assembly: Onbox.Revit.dll
Syntax
public class RevitExternalHandler : IRevitEventHandler, IExternalEventHandler
Constructors
| Improve this Doc View SourceRevitExternalHandler(RevitAsyncSettings, IRevitContext)
Constructor
Declaration
public RevitExternalHandler(RevitAsyncSettings settings, IRevitContext revitContext)
Parameters
Type | Name | Description |
---|---|---|
RevitAsyncSettings | settings | |
IRevitContext | revitContext |
Methods
| Improve this Doc View SourceCancelAll()
Cancels all queue tasks
Declaration
public void CancelAll()
Execute(UIApplication)
This method is called to handle the external event
Declaration
public void Execute(UIApplication app)
Parameters
Type | Name | Description |
---|---|---|
Autodesk.Revit.UI.UIApplication | app |
GetName()
The event's name
Declaration
public string GetName()
Returns
Type | Description |
---|---|
System.String |
GetQueueCount()
Gets the number of queue tasks
Declaration
public int GetQueueCount()
Returns
Type | Description |
---|---|
System.Int32 |
RunAsync(Action<UIApplication>, CancellationTokenSource)
The action will run by Revit as soon as its thread is available
Declaration
public Task RunAsync(Action<UIApplication> action, CancellationTokenSource cancelSource = null)
Parameters
Type | Name | Description |
---|---|---|
System.Action<Autodesk.Revit.UI.UIApplication> | action | |
System.Threading.CancellationTokenSource | cancelSource |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
RunAsync<T>(Func<UIApplication, T>, CancellationTokenSource)
The action will run by Revit as soon as its thread is available
Declaration
public Task<T> RunAsync<T>(Func<UIApplication, T> action, CancellationTokenSource cancelSource = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<Autodesk.Revit.UI.UIApplication, T> | action | |
System.Threading.CancellationTokenSource | cancelSource |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<T> |
Type Parameters
Name | Description |
---|---|
T |
Implements
Autodesk.Revit.UI.IExternalEventHandler