/// <summary> /// Raises the <see cref="EventHandlerInvoked"/> event. /// </summary> /// <param name="sender">Object which is the source of the original event.</param> /// <param name="args">Information about the original event.</param> /// <param name="invocationResult">Results of handling the event.</param> protected void RaiseEventHandlerInvoked(object sender, TEventArgs args, PSInvocationResult invocationResult) { PSInvocationEventHandlerInvokedArgs <TEventArgs> e = new PSInvocationEventHandlerInvokedArgs <TEventArgs>(sender, args, invocationResult); try { OnEventHandlerInvoked(e); } finally { try { EventHandler <PSInvocationEventHandlerInvokedArgs <TEventArgs> > eventHandlerInvoked = EventHandlerInvoked; if (eventHandlerInvoked != null) { eventHandlerInvoked(this, e); } } finally { EventHandler <PSInvocationEventHandlerInvokedArgs> eventHandlerInvoked = _eventHandlerInvoked; if (eventHandlerInvoked != null) { eventHandlerInvoked(this, e); } } } }
private void Handler_EventHandlerInvoked(object sender, PSInvocationEventHandlerInvokedArgs e) { IPSEventScriptHandler handler = sender as IPSEventScriptHandler; lock (_syncRoot) _eventHandlerResults.Add(new PSInvocationEventResult((handler == null) ? null : handler.Name, e)); }
/// <summary> /// This gets invoked after <see cref="HandlerScript"/> has handled the event. /// </summary> /// <param name="e"></param> protected virtual void OnEventHandlerInvoked(PSInvocationEventHandlerInvokedArgs <TEventArgs> e) { }