private void HandleInformationalMessageReceived(object sender, RemoteDataEventArgs <InformationalMessage> eventArgs)
        {
            using (tracer.TraceEventHandlers())
            {
                InformationalMessage data = eventArgs.Data;
                switch (data.DataType)
                {
                case RemotingDataType.PowerShellDebug:
                    this.informationalBuffers.AddDebug((DebugRecord)data.Message);
                    return;

                case RemotingDataType.PowerShellVerbose:
                    this.informationalBuffers.AddVerbose((VerboseRecord)data.Message);
                    return;

                case RemotingDataType.PowerShellWarning:
                    this.informationalBuffers.AddWarning((WarningRecord)data.Message);
                    return;

                case RemotingDataType.PowerShellProgress:
                    break;

                default:
                    return;
                }
                ProgressRecord item = (ProgressRecord)LanguagePrimitives.ConvertTo(data.Message, typeof(ProgressRecord), CultureInfo.InvariantCulture);
                this.informationalBuffers.AddProgress(item);
            }
        }
Exemple #2
0
        /// <summary>
        /// Handler for handling any informational message received
        /// from the server side.
        /// </summary>
        /// <param name="sender">sender of this event, unused.</param>
        /// <param name="eventArgs">arguments describing this event.</param>
        private void HandleInformationalMessageReceived(object sender,
                                                        RemoteDataEventArgs <InformationalMessage> eventArgs)
        {
            using (s_tracer.TraceEventHandlers())
            {
                InformationalMessage infoMessage = eventArgs.Data;

                switch (infoMessage.DataType)
                {
                case RemotingDataType.PowerShellDebug:
                {
                    informationalBuffers.AddDebug((DebugRecord)infoMessage.Message);
                }

                break;

                case RemotingDataType.PowerShellVerbose:
                {
                    informationalBuffers.AddVerbose((VerboseRecord)infoMessage.Message);
                }

                break;

                case RemotingDataType.PowerShellWarning:
                {
                    informationalBuffers.AddWarning((WarningRecord)infoMessage.Message);
                }

                break;

                case RemotingDataType.PowerShellProgress:
                {
                    ProgressRecord progress = (ProgressRecord)LanguagePrimitives.ConvertTo(infoMessage.Message,
                                                                                           typeof(ProgressRecord), System.Globalization.CultureInfo.InvariantCulture);
                    informationalBuffers.AddProgress(progress);
                }

                break;

                case RemotingDataType.PowerShellInformationStream:
                {
                    informationalBuffers.AddInformation((InformationRecord)infoMessage.Message);
                }

                break;
                }
            }
        }