Beispiel #1
0
 private void CreateDSHandler(TypeTable typeTable)
 {
     this.dataStructureHandler = new ClientRunspacePoolDataStructureHandler(this, typeTable);
     this.dataStructureHandler.RemoteHostCallReceived         += new EventHandler <RemoteDataEventArgs <RemoteHostCall> >(this.HandleRemoteHostCalls);
     this.dataStructureHandler.StateInfoReceived              += new EventHandler <RemoteDataEventArgs <RunspacePoolStateInfo> >(this.HandleStateInfoReceived);
     this.dataStructureHandler.RSPoolInitInfoReceived         += new EventHandler <RemoteDataEventArgs <RunspacePoolInitInfo> >(this.HandleInitInfoReceived);
     this.dataStructureHandler.ApplicationPrivateDataReceived += new EventHandler <RemoteDataEventArgs <PSPrimitiveDictionary> >(this.HandleApplicationPrivateDataReceived);
     this.dataStructureHandler.SessionClosing += new EventHandler <RemoteDataEventArgs <Exception> >(this.HandleSessionClosing);
     this.dataStructureHandler.SessionClosed  += new EventHandler <RemoteDataEventArgs <Exception> >(this.HandleSessionClosed);
     this.dataStructureHandler.SetMaxMinRunspacesResponseRecieved += new EventHandler <RemoteDataEventArgs <PSObject> >(this.HandleResponseReceived);
     this.dataStructureHandler.URIRedirectionReported             += new EventHandler <RemoteDataEventArgs <Uri> >(this.HandleURIDirectionReported);
     this.dataStructureHandler.PSEventArgsReceived    += new EventHandler <RemoteDataEventArgs <PSEventArgs> >(this.HandlePSEventArgsReceived);
     this.dataStructureHandler.SessionDisconnected    += new EventHandler <RemoteDataEventArgs <Exception> >(this.HandleSessionDisconnected);
     this.dataStructureHandler.SessionReconnected     += new EventHandler <RemoteDataEventArgs <Exception> >(this.HandleSessionReconnected);
     this.dataStructureHandler.SessionRCDisconnecting += new EventHandler <RemoteDataEventArgs <Exception> >(this.HandleSessionRCDisconnecting);
     this.dataStructureHandler.SessionCreateCompleted += new EventHandler <CreateCompleteEventArgs>(this.HandleSessionCreateCompleted);
 }
 internal RemoteRunspacePoolInternal(
     int minRunspaces,
     int maxRunspaces,
     TypeTable typeTable,
     PSHost host,
     PSPrimitiveDictionary applicationArguments,
     RunspaceConnectionInfo connectionInfo)
     : base(minRunspaces, maxRunspaces)
 {
     using (RemoteRunspacePoolInternal.tracer.TraceConstructor((object)this))
     {
         if (connectionInfo == null)
         {
             throw RemoteRunspacePoolInternal.tracer.NewArgumentNullException("WSManConnectionInfo");
         }
         this.etwTracer.OperationalChannel.WriteVerbose(PSEventId.RunspacePoolConstructor, PSOpcode.Constructor, PSTask.CreateRunspace, (object)this.instanceId, (object)this.minPoolSz.ToString((IFormatProvider)CultureInfo.InvariantCulture), (object)this.maxPoolSz.ToString((IFormatProvider)CultureInfo.InvariantCulture));
         if (connectionInfo is WSManConnectionInfo)
         {
             this.connectionInfo = (RunspaceConnectionInfo)((WSManConnectionInfo)connectionInfo).Copy();
         }
         else if (connectionInfo is NewProcessConnectionInfo)
         {
             this.connectionInfo = (RunspaceConnectionInfo)((NewProcessConnectionInfo)connectionInfo).Copy();
         }
         this.host = host;
         this.applicationArguments = applicationArguments;
         this.dispatchTable        = new System.Management.Automation.Remoting.DispatchTable <object>();
         this.dataStructureHandler = new ClientRunspacePoolDataStructureHandler(this, typeTable);
         this.dataStructureHandler.RemoteHostCallReceived         += new EventHandler <RemoteDataEventArgs <RemoteHostCall> >(this.HandleRemoteHostCalls);
         this.dataStructureHandler.StateInfoReceived              += new EventHandler <RemoteDataEventArgs <RunspacePoolStateInfo> >(this.HandleStateInfoReceived);
         this.dataStructureHandler.ApplicationPrivateDataReceived += new EventHandler <RemoteDataEventArgs <PSPrimitiveDictionary> >(this.HandleApplicationPrivateDataReceived);
         this.dataStructureHandler.SessionClosing += new EventHandler <RemoteDataEventArgs <Exception> >(this.HandleSessionClosing);
         this.dataStructureHandler.SessionClosed  += new EventHandler <RemoteDataEventArgs <Exception> >(this.HandleSessionClosed);
         this.dataStructureHandler.SetMaxMinRunspacesResponseRecieved += new EventHandler <RemoteDataEventArgs <PSObject> >(this.HandleResponseReceived);
         this.dataStructureHandler.URIRedirectionReported             += new EventHandler <RemoteDataEventArgs <Uri> >(this.HandleURIDirectionReported);
         this.dataStructureHandler.PSEventArgsReceived += new EventHandler <RemoteDataEventArgs <PSEventArgs> >(this.HandlePSEventArgsReceived);
     }
 }
 private void CreateDSHandler(TypeTable typeTable)
 {
     this.dataStructureHandler = new ClientRunspacePoolDataStructureHandler(this, typeTable);
     this.dataStructureHandler.RemoteHostCallReceived += new EventHandler<RemoteDataEventArgs<RemoteHostCall>>(this.HandleRemoteHostCalls);
     this.dataStructureHandler.StateInfoReceived += new EventHandler<RemoteDataEventArgs<RunspacePoolStateInfo>>(this.HandleStateInfoReceived);
     this.dataStructureHandler.RSPoolInitInfoReceived += new EventHandler<RemoteDataEventArgs<RunspacePoolInitInfo>>(this.HandleInitInfoReceived);
     this.dataStructureHandler.ApplicationPrivateDataReceived += new EventHandler<RemoteDataEventArgs<PSPrimitiveDictionary>>(this.HandleApplicationPrivateDataReceived);
     this.dataStructureHandler.SessionClosing += new EventHandler<RemoteDataEventArgs<Exception>>(this.HandleSessionClosing);
     this.dataStructureHandler.SessionClosed += new EventHandler<RemoteDataEventArgs<Exception>>(this.HandleSessionClosed);
     this.dataStructureHandler.SetMaxMinRunspacesResponseRecieved += new EventHandler<RemoteDataEventArgs<PSObject>>(this.HandleResponseReceived);
     this.dataStructureHandler.URIRedirectionReported += new EventHandler<RemoteDataEventArgs<Uri>>(this.HandleURIDirectionReported);
     this.dataStructureHandler.PSEventArgsReceived += new EventHandler<RemoteDataEventArgs<PSEventArgs>>(this.HandlePSEventArgsReceived);
     this.dataStructureHandler.SessionDisconnected += new EventHandler<RemoteDataEventArgs<Exception>>(this.HandleSessionDisconnected);
     this.dataStructureHandler.SessionReconnected += new EventHandler<RemoteDataEventArgs<Exception>>(this.HandleSessionReconnected);
     this.dataStructureHandler.SessionRCDisconnecting += new EventHandler<RemoteDataEventArgs<Exception>>(this.HandleSessionRCDisconnecting);
     this.dataStructureHandler.SessionCreateCompleted += new EventHandler<CreateCompleteEventArgs>(this.HandleSessionCreateCompleted);
 }