Beispiel #1
0
        /// <summary>
        /// Updates progress as each object in the current cmdlet is written to the pipeline.
        /// </summary>
        protected void DuringUpdateProgress(object obj)
        {
            if (!ProgressManager.ProgressEnabled)
            {
                return;
            }

            ProgressManager.CurrentState.Add(obj);
            ProgressManager.CurrentState.Current = obj;

            var prtgObj = obj as IObject;

            switch (GetSwitchScenario())
            {
            case ProgressScenario.NoProgress:
                break;

            case ProgressScenario.StreamProgress:
            case ProgressScenario.MultipleCmdlets:
                UpdateScenarioProgress_MultipleCmdlets(ProgressStage.BeforeEach, prtgObj);
                break;

            case ProgressScenario.VariableToSingleCmdlet:
                ProgressManager.CompletePrematurely(ProgressManager);
                break;

            case ProgressScenario.VariableToMultipleCmdlets:
            case ProgressScenario.MultipleCmdletsFromBlockingSelect:
                UpdateScenarioProgress_VariableToMultipleCmdlet(ProgressStage.BeforeEach, prtgObj);
                break;

            case ProgressScenario.SelectLast:
            case ProgressScenario.SelectSkipLast:
                if (ProgressManager.PartOfChain)
                {
                    UpdateScenarioProgress_VariableToMultipleCmdlet(ProgressStage.BeforeEach, prtgObj);
                }
                break;

            default:
                throw new NotImplementedException($"Handler for ProgressScenario '{ProgressManager.Scenario}' is not implemented");
            }
        }