예제 #1
0
        protected override void ProcessRecord()
        {
            using (ProgressManager = new ProgressManager(this))
            {
                switch (ParameterSetName)
                {
                case "ChainSourceId":
                    var sourceId = ProgressManager.GetLastSourceId();
                    CommandRuntime.WriteProgress(sourceId, new ProgressRecord(2, $"Test-Reflection2 Activity for object '{Object}' with source ID '{sourceId}'", "Test-Reflection2 Description")
                    {
                        ParentActivityId = 1
                    });
                    Thread.Sleep(1);
                    WriteObject(Convert.ToInt32(((PSObject)Object).BaseObject) * 2);
                    break;

                case "Downstream":
                    WriteObject(Object);
                    break;

                case "CmdletInput":
                    WriteObject(cacheManager.GetCmdletPipelineInput().List, true);
                    break;

                default:
                    throw new NotImplementedException(ParameterSetName);
                }
            }
        }
예제 #2
0
        protected override void ProcessRecord()
        {
            using (ProgressManager = new ProgressManager(this))
            {
                switch (ParameterSetName)
                {
                case "SourceId":
                    WriteObject(ProgressManager.GetLastSourceId());
                    break;

                case "ChainSourceId":
                    record = new ProgressRecord(1, "Test-Reflection1 Activity", "Test-Reflection1 Description");
                    WriteProgress(record);
                    Thread.Sleep(1);
                    WriteObject(new[] { 1, 2, 3 }, true);
                    break;

                case "Downstream":
                    WriteObject(cacheManager.GetDownstreamCmdletInfo().Name);
                    break;

                case "CmdletInput":
                    WriteObject(new[] { 1, 2, 3 }, true);
                    break;

                case "VariableInputArray":
                case "VariableInputObject":
                    WriteObject(cacheManager.GetCmdletPipelineInput().List, true);
                    break;

                default:
                    throw new NotImplementedException(ParameterSetName);
                }
            }
        }
예제 #3
0
        protected override void ProcessRecord()
        {
            using (ProgressManager = new ProgressManager(this))
            {
                switch (ParameterSetName)
                {
                case "ChainSourceId":
                    var sourceId = ProgressManager.GetLastSourceId();
                    CommandRuntime.WriteProgress(sourceId, new ProgressRecord(3, $"Test-Reflection3 Activity for object '{Object}' with source ID '{sourceId}'", "Test-Reflection3 Description")
                    {
                        ParentActivityId = 2
                    });
                    Thread.Sleep(1);
                    WriteObject(sourceId);
                    break;

                default:
                    throw new NotImplementedException(ParameterSetName);
                }
            }
        }