private void ExecutePipeline(string[] commands, IEnumerable input, PipelineOutputHandler callback)
 {
    // TODO: Solve the threading problem without breaking COM
    // The PowerShell runspace isn't threaded, so it can't INVOKE a pipeline while there's another one open...
    // having a bunch of BackgroundWorkers "magically" solved this for me, but ...
    // apparently causes COM's RCW(Runtime Callable Wrapper) to be disposed (or abandoned in another thread)
    // It seems the best way to multithread the UI is to have a persistent background worker thread
    // which would pull the pipeline and Input objects out and run them as fast as it could, 
    // while the front end queues them up as fast as it *wants* to.
    _runner.Enqueue(new InputBoundCommand(commands, input, callback));
 }
		public InputBoundCommand( /*Pipeline pipeline,*/
		   string[] commands, IEnumerable input, bool addToHistory, PipelineOutputHandler callback)
		{
			//Pipeline = pipeline;
			Commands = commands;
			Input = input;
			Callback = callback;
			AddToHistory = addToHistory;

			DefaultOutput = true;
			RunAsScript = true;
			UseLocalScope = false;
		}
 private void ExecutePipelineOutDefault(string command, IEnumerable input, bool addToHistory, PipelineOutputHandler callback)
 {
    ExecutePipeline((new[] { command }), input, callback); 
    //  CreatePipelineOutDefault(command, addToHistory), input, callback);
 }
      // [rgn] Private Methods (17)




      //private PipelineState _state = PipelineState.NotStarted;
      //void pipeline_StateChanged(object sender, PipelineStateEventArgs e)
      //{
      //   _state = e.PipelineStateInfo.State;
      //}

      //private void ExecutePipeline(Command command, PipelineOutputHandler callback)
      //{
      //   ExecutePipeline(command, EmptyArray, callback);
      //}

      //private void ExecutePipeline(Command command, IEnumerable input, PipelineOutputHandler callback)
      //{
      //   ExecutePipeline(new Command[] { command }, input, callback);
      //}

      //private void ExecutePipeline(Command[] commands, PipelineOutputHandler callback)
      //{
      //   ExecutePipeline(commands, EmptyArray, callback);
      //}

      private void ExecutePipelineOutDefault(string command, bool addToHistory, PipelineOutputHandler callback)
      {
         ExecutePipelineOutDefault( command, EmptyArray, addToHistory, callback);
      }