/// <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); } } } }
/// <summary> /// Initialize new <see cref="PSInvocationEventHandlerInvokedArgs"/> object. /// </summary> /// <param name="sender">Object which was the source of the event.</param> /// <param name="eventArgs">Information about the event.</param> /// <param name="invocationResult">Result from the event handler.</param> protected PSInvocationEventHandlerInvokedArgs(object sender, EventArgs eventArgs, PSInvocationResult invocationResult) { _sender = sender; _eventArgs = eventArgs; _ranToCompletion = invocationResult.RanToCompletion; _hadErrors = invocationResult.HadErrors; _output = invocationResult.Output; _variables = invocationResult.Variables; _errors = invocationResult.Errors; _warnings = invocationResult.Warnings; _verbose = invocationResult.Verbose; _debug = invocationResult.Debug; }