Table of Contents

Interface IRelaysPerformanceEvents

Namespace
CSF.Screenplay.Performances
Assembly
CSF.Screenplay.Abstractions.dll

An object which can relay events that relate to a IPerformance

public interface IRelaysPerformanceEvents

Remarks

This object is used as an event sink; a single point of contact to which many objects may send events. This allows event consumers to receive events from many origins by subscribing to only a single object. There should only be a single instance of an object which implements this interface, for the lifetime of a Screenplay.

This type is closely related to IHasPerformanceEvents. This is the event sink and IHasPerformanceEvents is the publisher of those events. Despite this, their APIs are not symmetrical, as many of the events published are derived by subscribing to an Actor instance.

Methods

InvokeActorCreated(string, Guid)

Invokes an event indicating that a new Actor has been created and added to the IPerformance.

void InvokeActorCreated(string actorName, Guid performanceIdentity)

Parameters

actorName string

The actor's human-readable name.

performanceIdentity Guid

A unique identifier for the current IPerformance.

InvokeActorSpotlit(string, Guid)

Invokes an event indicating that an Actor has been placed into the Spotlight of an IStage.

void InvokeActorSpotlit(string actorName, Guid performanceIdentity)

Parameters

actorName string

The actor's human-readable name.

performanceIdentity Guid

A unique identifier for the current IPerformance.

InvokeGainedAbility(string, Guid, object)

Invokes an event indicating that a new Actor has gained an ability.

void InvokeGainedAbility(string actorName, Guid performanceIdentity, object ability)

Parameters

actorName string

The actor's human-readable name.

performanceIdentity Guid

A unique identifier for the current IPerformance.

ability object

The ability that the actor has gained.

Remarks

Use this method only when an actor gains one or more abilities before the the SubscribeTo(Actor) method has been used to subscribe to the actor. Once the actor has been subscribed-to by an implementation of this instance, their newly-added abilities will automatically be captured.

In some circumstances where the actor is fully created and has their abilities granted BEFORE there has been an opportunity to subscribe to them, then this method is required to retrospectively trigger the abilitiy-granted event. This is applicable for actors who are created by an IPersona, which might grant the actors one or more abilities immediately, as part of their creation.

InvokePerformanceBegun(Guid, IList<IdentifierAndName>)

Invokes an event indicating that a IPerformance has begun.

void InvokePerformanceBegun(Guid performanceIdentity, IList<IdentifierAndName> namingHierarchy)

Parameters

performanceIdentity Guid

The performance identity

namingHierarchy IList<IdentifierAndName>

The performance's hierarchical name

InvokePerformanceFinished(Guid, IList<IdentifierAndName>, bool?)

Invokes an event indicating that a IPerformance has finished.

void InvokePerformanceFinished(Guid performanceIdentity, IList<IdentifierAndName> namingHierarchy, bool? success)

Parameters

performanceIdentity Guid

The performance identity

namingHierarchy IList<IdentifierAndName>

The performance's hierarchical name

success bool?

A value indicating whether or not the performance was a success

InvokeScreenplayEnded()

Invokes an event indicating that a Screenplay has ended.

void InvokeScreenplayEnded()

InvokeScreenplayStarted()

Invokes an event indicating that a Screenplay has started.

void InvokeScreenplayStarted()

InvokeSpotlightTurnedOff(Guid)

Invokes an event indicating that the Spotlight of the IStage has been 'turned off'.

void InvokeSpotlightTurnedOff(Guid performanceIdentity)

Parameters

performanceIdentity Guid

A unique identifier for the current IPerformance.

SubscribeTo(Actor)

Subscribes to (and relays) events from the specified actor.

void SubscribeTo(Actor actor)

Parameters

actor Actor

The actor to which this relay should subscribe.

UnsubscribeFrom(Actor)

Unsubscribes from events from the specified actor.

void UnsubscribeFrom(Actor actor)

Parameters

actor Actor

The actor from which this relay should unsubscribe.

Remarks

This method is typically used when the actor instance is about to be disposed, such as at the end of a IPerformance.

UnsubscribeFromAllActors(Guid)

Unsubscribes from all of the events for all of the actors who are part of the the IPerformance, indicated by its identity.

void UnsubscribeFromAllActors(Guid performanceIdentity)

Parameters

performanceIdentity Guid

The identity of a performance.

Remarks

Using this method is equivalent to calling UnsubscribeFrom(Actor) for every Actor which is participating in the specified performance.

Use this method when ending a performance, as a convenience to unsubscribe from all of its actors at once.

See Also