Action<Action<RemoteTask>> CreateTaskNotificationFor(object infoFromRunner, object maybeContext)
{
return actionToBePerformedForEachTask =>
{
bool invoked = false;
foreach (var notification in _taskNotifications)
{
if (!notification.Matches(infoFromRunner, maybeContext))
{
continue;
}
Debug.WriteLine(String.Format("Invoking notification for {0}", notification.ToString()));
invoked = true;
foreach (var task in notification.RemoteTasks)
{
actionToBePerformedForEachTask(task);
}
}
if (!invoked)
{
Debug.WriteLine(String.Format("No matching notification for {0} received by the runner",
infoFromRunner.ToString()));
}
};
}