コード例 #1
0
 internal void SendStateChangedInformationToClient(PSInvocationStateInfo stateInfo)
 {
     this.SendDataAsync(RemotingEncoder.GeneratePowerShellStateInfo(stateInfo, this.clientPowerShellId, this.clientRunspacePoolId));
     if (this.clientPowerShellId != Guid.Empty)
     {
         this.transportManager.Closing -= new EventHandler(this.HandleTransportClosing);
         this.transportManager.Close(null);
     }
 }
コード例 #2
0
 internal void SendStateChangedInformationToClient(PSInvocationStateInfo stateInfo)
 {
     using (ServerPowerShellDataStructureHandler.tracer.TraceMethod())
     {
         this.SendDataAsync(RemotingEncoder.GeneratePowerShellStateInfo(stateInfo, this.clientPowerShellId, this.clientRunspacePoolId));
         if (!(this.clientPowerShellId != Guid.Empty))
         {
             return;
         }
         this.transportManager.Closing -= new EventHandler(this.HandleTransportClosing);
         this.transportManager.Close((Exception)null);
     }
 }
コード例 #3
0
        /// <summary>
        /// Send the state information to the client.
        /// </summary>
        /// <param name="stateInfo">state information to be
        /// sent to the client</param>
        internal void SendStateChangedInformationToClient(PSInvocationStateInfo
                                                          stateInfo)
        {
            Dbg.Assert((stateInfo.State == PSInvocationState.Completed) ||
                       (stateInfo.State == PSInvocationState.Failed) ||
                       (stateInfo.State == PSInvocationState.Stopped),
                       "SendStateChangedInformationToClient should be called to notify a termination state");
            SendDataAsync(RemotingEncoder.GeneratePowerShellStateInfo(
                              stateInfo, _clientPowerShellId, _clientRunspacePoolId));

            // Close the transport manager only if the PowerShell Guid != Guid.Empty.
            // When Guid.Empty is used, PowerShell must be using pool's transport manager
            // to send data to client.
            if (_clientPowerShellId != Guid.Empty)
            {
                // no need to listen for closing events as we are initiating the close
                _transportManager.Closing -= HandleTransportClosing;
                // if terminal state is reached close the transport manager instead of letting
                // the client initiate the close.
                _transportManager.Close(null);
            }
        }