コード例 #1
0
ファイル: PrtgProgressCmdlet.cs プロジェクト: runnane/PrtgAPI
        private ProgressScenario GetSwitchScenario()
        {
            var scenario = ProgressManager.Scenario;

            if (scenario == ProgressScenario.SelectLast || scenario == ProgressScenario.SelectSkipLast)
            {
                scenario = ProgressManager.CalculateNonBlockingProgressScenario();

                if (scenario == ProgressScenario.NoProgress)
                {
                    scenario = ProgressScenario.VariableToSingleCmdlet;
                }
                else if (scenario == ProgressScenario.MultipleCmdlets) //We don't want MultipleCmdlets, because that makes us responsible for updating the records processed on each iteration
                {
                    scenario = ProgressScenario.VariableToMultipleCmdlets;
                }

                if (ProgressManager.Scenario == ProgressScenario.SelectSkipLast)
                {
                    //We can't trust PartOfChain as the cmdlets before us haven't been destroyed yet. So instead,
                    //the question is are there any cmdlets after us?

                    if (ProgressManager.LastInChain)
                    {
                        scenario = ProgressScenario.VariableToSingleCmdlet;
                    }
                }
            }

            return(scenario);
        }