コード例 #1
0
ファイル: Pipeline.cs プロジェクト: Adebeer/pypn
        public void RunCommand <TPayload>(string commandName, TPayload payload)
        {
            var commandParams = new CommandParams <TPayload>(commandName)
            {
                Payload = payload
            };

            var callContext = new StageCallContext <TPayload>(commandName, commandParams, Stages.Count);

            if (callContext.MaxStageIndex > 0)
            {
                RunNextStageCommand(callContext, 0);
            }
        }
コード例 #2
0
ファイル: Pipeline.cs プロジェクト: Adebeer/pypn
        public void RunAdHocCommand <TStage, TPayload>(string defaultCommandName, TPayload payload, ICommandDefinition <TStage, TPayload> command)
            where TStage : class
        {
            var commandParams = new CommandParams <TPayload>(defaultCommandName)
            {
                Payload = payload
            };

            var customCommands = Stages.OfType <PipelineStage <TStage> >()
                                 .ToDictionary(
                x => x.Config.Name,
                x => (IStageCommand <TPayload>) new StageCommand <TStage, TPayload>(x.Stage, command));

            var callContext = new StageCallContext <TPayload>(defaultCommandName, commandParams, Stages.Count, customCommands);

            if (callContext.MaxStageIndex > 0)
            {
                RunNextStageCommand(callContext, 0);
            }
        }