Files
speckle-sharp-connectors/Connectors/Revit/Speckle.Connectors.RevitShared/Plugin/RevitTask.cs
T
Adam Hathcock bd3e20a082 New project to internalize Revit.Async (#852)
* New project to internalize Revit.Async

* formatting

* Regenerate slns

* My change

---------

Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>
2025-05-22 14:10:54 +00:00

22 lines
842 B
C#

using Speckle.Connectors.Common.Threading;
using Speckle.Connectors.DUI.Bridge;
using Speckle.Connectors.Revit.Common;
using Speckle.InterfaceGenerator;
namespace Speckle.Connectors.Revit.Plugin;
[GenerateAutoInterface]
public class RevitTask(ITopLevelExceptionHandler topLevelExceptionHandler) : IRevitTask
{
public void Run(Func<Task> handler) =>
RevitAsync.RunAsync(() => topLevelExceptionHandler.FireAndForget(handler)).FireAndForget();
public void Run(Action handler) =>
RevitAsync.RunAsync(() => topLevelExceptionHandler.CatchUnhandled(handler)).FireAndForget();
public Task RunAsync(Func<Task> handler) =>
RevitAsync.RunAsync(() => topLevelExceptionHandler.CatchUnhandledAsync(handler));
public Task RunAsync(Action handler) => RevitAsync.RunAsync(() => topLevelExceptionHandler.CatchUnhandled(handler));
}