private void PipelineExecutor_OnErrorReady(PipelineExecutor sender, ICollection <object> data) { foreach (object e in data) { AppendLine(e.ToString()); } }
private void PipelineExecutor_OnDataReady(PipelineExecutor sender, ICollection <System.Management.Automation.PSObject> data) { foreach (PSObject obj in data) { AppendLine(obj.ToString()); } }
public void startPowerShellScript(String strScript) { _pipelineExecutor = new PipelineExecutor(_powerShellRunSpace, this, strScript); _pipelineExecutor.OnDataEnd += new PipelineExecutor.DataEndDelegate(PipelineExecutor_OnDataEnd); _pipelineExecutor.OnDataReady += new PipelineExecutor.DataReadyDelegate(PipelineExecutor_OnDataReady); _pipelineExecutor.OnErrorReady += new PipelineExecutor.ErrorReadyDelegate(PipelineExecutor_OnErrorReady); _pipelineExecutor.Start(); }
/// <summary> /// private ErrorReady handling method that will pass the call on to any event handlers that are /// attached to the OnErrorReady event of this <see cref="PipelineExecutor"/> instance. /// </summary> /// <param name="sender"></param> /// <param name="data"></param> private void SynchErrorReady(PipelineExecutor sender, ICollection <object> data) { ErrorReadyDelegate delegateErrorReadyCopy = OnErrorReady; if (delegateErrorReadyCopy != null) { delegateErrorReadyCopy(sender, data); } }
/// <summary> /// private DataEnd handling method that will pass the call on to any handlers that are /// attached to the OnDataEnd event of this <see cref="PipelineExecutor"/> instance. /// </summary> /// <param name="sender"></param> /// <param name="data"></param> private void SynchDataEnd(PipelineExecutor sender) { DataEndDelegate delegateDataEndCopy = OnDataEnd; if (delegateDataEndCopy != null) { delegateDataEndCopy(sender); } }
/// <summary> /// private DataReady handling method that will pass the call on to any event handlers that are /// attached to the OnDataReady event of this <see cref="PipelineExecutor"/> instance. /// </summary> /// <param name="sender"></param> /// <param name="data"></param> private void SynchDataReady(PipelineExecutor sender, ICollection <PSObject> data) { DataReadyDelegate delegateDataReadyCopy = OnDataReady; if (delegateDataReadyCopy != null) { delegateDataReadyCopy(sender, data); } }
private void stopPowerShellScript() { if (_pipelineExecutor != null) { _pipelineExecutor.OnDataEnd -= new PipelineExecutor.DataEndDelegate(PipelineExecutor_OnDataEnd); _pipelineExecutor.OnDataReady -= new PipelineExecutor.DataReadyDelegate(PipelineExecutor_OnDataReady); _pipelineExecutor.OnErrorReady -= new PipelineExecutor.ErrorReadyDelegate(PipelineExecutor_OnErrorReady); _pipelineExecutor.Stop(); _pipelineExecutor = null; System.Threading.Thread.Sleep(100); } }
private void PipelineExecutor_OnDataEnd(PipelineExecutor sender) { EventArgs e = new EventArgs(); if (sender.Pipeline.PipelineStateInfo.State == PipelineState.Failed) { AppendLine(string.Format("Error in script: {0}", sender.Pipeline.PipelineStateInfo.Reason)); } else { AppendLine("Ready."); ProjectCheckoutDone(this, e); } }