bd3e20a082
* New project to internalize Revit.Async * formatting * Regenerate slns * My change --------- Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>
22 lines
842 B
C#
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));
|
|
}
|