Beispiel #1
0
 public DagentPSHostUserInterface(DagentPSHost host)
 {
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     _host = host;
 }
        private static Tuple <Runspace, DagentPSHost> CreateRunspace(IConsole console, string hostName)
        {
            var initialSessionState = InitialSessionState.CreateDefault();
            var privateData         = new Tuple <string, object>[] { };
            var host = new DagentPSHost(hostName, privateData)
            {
                ActiveConsole = console
            };
            var runspace = RunspaceFactory.CreateRunspace(host, initialSessionState);

            runspace.ThreadOptions = PSThreadOptions.Default;
            runspace.Open();
            //
            // Set this runspace as DefaultRunspace so I can script DTE events.
            // WARNING: MSDN says this is unsafe. The runspace must not be shared across threads. I need this to be able to use ScriptBlock for DTE events. The ScriptBlock event handlers execute on DefaultRunspace.
            //
            Runspace.DefaultRunspace = runspace;
            return(Tuple.Create(runspace, host));
        }
 public Commander(DagentPSHost host)
 {
     _host = host;
 }
Beispiel #4
0
 public DagentPSHostRawUserInterface(DagentPSHost host)
 {
     _host = host;
 }