NuGetConsole.Host.PowerShell.Implementation.RunspaceDispatcher.InvokeCommands C# (CSharp) Method

InvokeCommands() public method

public InvokeCommands ( System.Management.Automation.PSCommand profileCommands ) : void
profileCommands System.Management.Automation.PSCommand
return void
        public void InvokeCommands(PSCommand[] profileCommands)
        {
            lock (_dispatcherLock)
            {
                using (var powerShell = System.Management.Automation.PowerShell.Create())
                {
                    powerShell.Runspace = _runspace;

                    foreach (PSCommand command in profileCommands)
                    {
                        powerShell.Commands = command;
                        powerShell.AddCommand("out-default");
                        powerShell.Invoke();
                    }
                }
            }
        }

Usage Example

Exemplo n.º 1
0
 private static void LoadProfilesIntoRunspace(RunspaceDispatcher runspace)
 {
     PSCommand[] profileCommands = HostUtilities.GetProfileCommands(ProfilePrefix);
     runspace.InvokeCommands(profileCommands);
 }
All Usage Examples Of NuGetConsole.Host.PowerShell.Implementation.RunspaceDispatcher::InvokeCommands