Open grizoood opened 2 years ago
Hi,
There is a Revit Event handler similar to Revt.Async here
https://github.com/engthiago/Onboxframework/blob/master/src/Revit/Async/IRevitEventHandler.cs
Just register it into container
container.AddRevitAsync(asyncSettings);
public class SampleClass
{
private readonly IRevitEventHandler _eventHandler;
public SampleClass(IRevitEventHandler eventHandler)
{
_eventHandler = eventHandler;
}
}
And use it like below.
// With return value
public async Task<T> GetSomethingFromRevit
{
var returnValue = await _eventHandler.RunAsync(uiApp =>
{
// Access Revit Application Classes as such
var doc = uiApp.ActiveUIDocument.Document;
return something;
});
}
// As void
public async Task DoSomethingInRevit
{
await _eventHandler.RunAsync(uiApp =>
{
// Access Revit Application Classes as such
var doc = uiApp.ActiveUIDocument.Document;
// Your Logic Here
}
}
Hello,
Your framework looks great, but I'm stuck on how to implement an external event asynchronously. Could you provide an example please.
Another question is it possible to pass parameters to the external event and have an object in return?
A bit like this: https://github.com/KennanChan/Revit.Async