PSEventManager Class

Definition

Represents the interface to the PowerShell eventing functionality. This class allows you to subscribe to, and receive events.

public abstract class PSEventManager
Inheritance
PSEventManager

Constructors

PSEventManager()

Properties

ReceivedEvents

Represents the interface to the PowerShell event queue.

Subscribers

Gets the list of event subscribers.

Methods

CreateEvent(String, Object, Object[], PSObject)

Creates a PowerShell event.

        <param name="sourceIdentifier">
        An optional identifier that identifies the source event
        </param><param name="sender">
        The object that generated this event
        </param><param name="args">
        Any event-specific data associated with the event.
        </param><param name="extraData">
        Any additional data you wish to attach to the event
        </param>
GenerateEvent(String, Object, Object[], PSObject)

Generate a PowerShell event.

        <param name="sourceIdentifier">
        An optional identifier that identifies the source event
        </param><param name="sender">
        The object that generated this event
        </param><param name="args">
        Any event-specific data associated with the event.
        </param><param name="extraData">
        Any additional data you wish to attach to the event
        </param>
GenerateEvent(String, Object, Object[], PSObject, Boolean, Boolean)

Generate a PowerShell event.

        <param name="sourceIdentifier">
        An optional identifier that identifies the source event
        </param><param name="sender">
        The object that generated this event
        </param><param name="args">
        Any event-specific data associated with the event.
        </param><param name="extraData">
        Any additional data you wish to attach to the event
        </param><param name="processInCurrentThread">
        True if the event should be triggered in current thread. False for the event
        to be triggered in a separate thread.
        </param><param name="waitForCompletionInCurrentThread">
        Wait for the event and associated action to be processed and completed.
        </param>
GetEventSubscribers(String)

Get the event subscription that corresponds to an identifier

        <param name="sourceIdentifier">
        The identifier that identifies the source of the events
        </param>
GetNextEventId()

Returns a sequential event ID

ProcessNewEvent(PSEventArgs, Boolean)

Processes new events (which have either been generated by this instance or forwarded to it)

ProcessNewEvent(PSEventArgs, Boolean, Boolean)

Processes new events (which have either been generated by this instance or forwarded to it)

SubscribeEvent(Object, String, String, PSObject, PSEventReceivedEventHandler, Boolean, Boolean)

Subscribes to an event on an object.

        <param name="source">
        The source object that defines the event
        </param><param name="eventName">
        The event to subscribe
        </param><param name="sourceIdentifier">
        An optional subscription identifier to help identify this event subscription
        </param><param name="data">
        Any additional data you wish to attach to the event
        </param><param name="handlerDelegate">
        Any action to be invoked when the event arrives
        </param><param name="supportEvent">
        Any action to be invoked when the event arrives
        </param><param name="forwardEvent">
        Whether events in this subscriber should be forwarded to the client PowerShell during remote executions
        </param>
SubscribeEvent(Object, String, String, PSObject, ScriptBlock, Boolean, Boolean)

Subscribes to an event on an object.

        <param name="source">
        The source object that defines the event
        </param><param name="eventName">
        The event to subscribe
        </param><param name="sourceIdentifier">
        An optional subscription identifier to help identify this event subscription
        </param><param name="data">
        Any additional data you wish to attach to the event
        </param><param name="action">
        Any action to be invoked when the event arrives
        </param><param name="supportEvent">
        Any action to be invoked when the event arrives
        </param><param name="forwardEvent">
        Whether events in this subscriber should be forwarded to the client PowerShell during remote executions
        </param>
SubscribeEvent(Object, String, String, PSObject, PSEventReceivedEventHandler, Boolean, Boolean, Int32)

Subscribes to an event on an object.

        <param name="source">
        The source object that defines the event
        </param><param name="eventName">
        The event to subscribe
        </param><param name="sourceIdentifier">
        An optional subscription identifier to help identify this event subscription
        </param><param name="data">
        Any additional data you wish to attach to the event
        </param><param name="handlerDelegate">
        Any action to be invoked when the event arrives
        </param><param name="supportEvent">
        Any action to be invoked when the event arrives
        </param><param name="forwardEvent">
        Whether events in this subscriber should be forwarded to the client PowerShell during remote executions
        </param><param name="maxTriggerCount">
        Indicate how many times the subscriber should be triggered before auto-unregister it
        If the value is equal or less than zero, there is no limit on the number of times the event can be triggered without being unregistered
        </param>
SubscribeEvent(Object, String, String, PSObject, ScriptBlock, Boolean, Boolean, Int32)

Subscribes to an event on an object.

        <param name="source">
        The source object that defines the event
        </param><param name="eventName">
        The event to subscribe
        </param><param name="sourceIdentifier">
        An optional subscription identifier to help identify this event subscription
        </param><param name="data">
        Any additional data you wish to attach to the event
        </param><param name="action">
        Any action to be invoked when the event arrives
        </param><param name="supportEvent">
        Any action to be invoked when the event arrives
        </param><param name="forwardEvent">
        Whether events in this subscriber should be forwarded to the client PowerShell during remote executions
        </param><param name="maxTriggerCount">
        Indicate how many times the subscriber should be triggered before auto-unregister it
        If the value is equal or less than zero, there is no limit on the number of times the event can be triggered without being unregistered
        </param>
UnsubscribeEvent(PSEventSubscriber)

Unsubscribes from an event on an object.

        <param name="subscriber">
        The subscriber associated with the event subscription
        </param>