DynamoVisualProgramming.DynamoServices by Autodesk

<PackageReference Include="DynamoVisualProgramming.DynamoServices" Version="2.0.4.11375" />

 ExecutionEvents

public static class ExecutionEvents
Communication bridge between Dynamo and client libraries to notify about changes to execution state
using Dynamo.Session; namespace Dynamo.Events { public static class ExecutionEvents { public static IExecutionSession ActiveSession { get; set; } public static event ExecutionStateHandler GraphPreExecution; public static event ExecutionStateHandler GraphPostExecution; internal static void OnGraphPreExecution(IExecutionSession session) { ActiveSession = session; if (ExecutionEvents.GraphPreExecution != null) ExecutionEvents.GraphPreExecution(session); } internal static void OnGraphPostExecution(IExecutionSession session) { ActiveSession = null; if (ExecutionEvents.GraphPostExecution != null) ExecutionEvents.GraphPostExecution(session); } } }