Beispiel #1
0
 private void pipelineExecutor_OnErrorReady(PipelineExecutor sender, ICollection<object> data)
 {
     foreach (object e in data)
     {
         AppendLine("Error : " + e.ToString());
     }
 }
Beispiel #2
0
 private void pipelineExecutor_OnDataReady(PipelineExecutor sender, ICollection<PSObject> data)
 {
     foreach (PSObject obj in data)
     {
         AppendLine(obj.ToString());
     }
 }
Beispiel #3
0
 private void StartScript()
 {
     pipelineExecutor = new PipelineExecutor(runSpace, this.Dispatcher, ScriptTextbox.Text);
     pipelineExecutor.OnDataReady += new PipelineExecutor.DataReadyDelegate(pipelineExecutor_OnDataReady);
     pipelineExecutor.OnDataEnd += new PipelineExecutor.DataEndDelegate(pipelineExecutor_OnDataEnd);
     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 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);
            }
        }
        /// <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);
            }
        }
Beispiel #7
0
 private void StopScript()
 {
     if (pipelineExecutor != null)
     {
         pipelineExecutor.OnDataReady -= new PipelineExecutor.DataReadyDelegate(pipelineExecutor_OnDataReady);
         pipelineExecutor.OnDataEnd -= new PipelineExecutor.DataEndDelegate(pipelineExecutor_OnDataEnd);
         pipelineExecutor.Stop();
         pipelineExecutor = null;
     }
 }
Beispiel #8
0
 private void pipelineExecutor_OnDataEnd(PipelineExecutor sender)
 {
     if (sender.Pipeline.PipelineStateInfo.State == PipelineState.Failed)
     {
         AppendLine(string.Format("Error in script: {0}", sender.Pipeline.PipelineStateInfo.Reason));
     }
     else
     {
         AppendLine("Starting script complete.");
     }
 }