public HyperNodeTaskActivityTracker(ITaskEventContext taskContext, IHyperNodeEventHandler eventHandler, Action cancelTaskAction)
 {
     _taskContext      = taskContext;
     _eventHandler     = eventHandler;
     _cancelTaskAction = () =>
     {
         Track("Task cancellation requested from user-defined code.");
         cancelTaskAction();
     };
 }
        private static void ConfigureHyperNodeEventHandler(HyperNodeService service, IHyperNodeConfiguration config)
        {
            IHyperNodeEventHandler eventHandler = null;

            // Set our event handler if applicable, but if we have any problems creating the instance or casting to HyperNodeEventHandlerBase, we deliberately want to fail out and make them fix the configuration
            if (!string.IsNullOrWhiteSpace(config.HyperNodeEventHandlerType))
            {
                eventHandler = (IHyperNodeEventHandler)Activator.CreateInstance(Type.GetType(config.HyperNodeEventHandlerType, true));
                eventHandler.Initialize();
            }

            service.EventHandler = eventHandler ?? DefaultEventHandler;
        }