示例#1
0
 private void PipelineExecutor_OnErrorReady(PipelineExecutor sender, ICollection <object> data)
 {
     foreach (object e in data)
     {
         AppendLine(e.ToString());
     }
 }
示例#2
0
 private void PipelineExecutor_OnDataReady(PipelineExecutor sender, ICollection <System.Management.Automation.PSObject> data)
 {
     foreach (PSObject obj in data)
     {
         AppendLine(obj.ToString());
     }
 }
示例#3
0
        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();
        }
示例#4
0
        /// <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);
            }
        }
示例#5
0
        /// <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);
            }
        }
示例#6
0
        /// <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);
            }
        }
示例#7
0
 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);
     }
 }
示例#8
0
        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);
            }
        }