Exemple #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);
                }
            }
        }
Exemple #2
0
        protected override void ProcessRecord()
        {
            using (ProgressManager = new ProgressManager(this))
            {
                switch (ParameterSetName)
                {
                case "SourceId":
                    WriteObject(ProgressManager.GetLastSourceId());
                    break;

                case "ChainSourceId":
                    WriteProgress(new ProgressRecord(1, "Test-Reflection1 Activity", "Test-Reflection1 Description"));
                    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);
                }
            }
        }