private void InitializeRunspaceAndHost() { if (null == _shellConfiguration.RunspaceConfiguration) { _shellConfiguration.RunspaceConfiguration = RunspaceConfiguration.Create(); } _shellConfiguration.Cmdlets.ToList().ForEach( cce => _shellConfiguration.RunspaceConfiguration.Cmdlets.Append(cce) ); _rawUi = new HostRawUI(_consoleWindow, _shellConfiguration.ShellName); _hostUi = new HostUI(_consoleWindow, _shellConfiguration.UISettings, _rawUi); _host = new Host.Host(_shellConfiguration.ShellName, _shellConfiguration.ShellVersion, _hostUi, _shellConfiguration.RunspaceConfiguration); _hostUi.Progress += NotifyProgress; _runspace = _host.Runspace; _runspace.Open(); _commandExecutor = new Executor(_runspace); _shellConfiguration.InitialVariables.ToList().ForEach(pair => _runspace.SessionStateProxy.PSVariable.Set(pair) ); }
private void InitializeRunspaceAndHost() { if (null == _shellConfiguration.RunspaceConfiguration) { _shellConfiguration.RunspaceConfiguration = RunspaceConfiguration.Create(); } _shellConfiguration.Cmdlets.ToList().ForEach( cce => _shellConfiguration.RunspaceConfiguration.Cmdlets.Append(cce) ); _rawUi = new HostRawUI(_consoleWindow, _shellConfiguration.ShellName); _hostUi = new HostUI(_consoleWindow, _shellConfiguration.UISettings, _rawUi); _host = new Host.Host(_shellConfiguration.ShellName, _shellConfiguration.ShellVersion, _hostUi, _shellConfiguration.RunspaceConfiguration); _hostUi.Progress += NotifyProgress; _runspace = _host.Runspace; _runspace.Open(); _commandExecutor = new Executor(_runspace); _commandExecutor.PipelineException += OnPipelineException; _shellConfiguration.InitialVariables.ToList().ForEach(pair => _runspace.SessionStateProxy.PSVariable.Set(pair) ); }