コード例 #1
0
ファイル: Flowchart.cs プロジェクト: jimitndiaye/corewf
        private bool ExecuteSingleNode(NativeActivityContext context, FlowNode node, out FlowNode nextNode)
        {
            Fx.Assert(node != null, "caller should validate");
            FlowStep step = node as FlowStep;

            if (step != null)
            {
                if (_onStepCompleted == null)
                {
                    _onStepCompleted = new CompletionCallback(this.OnStepCompleted);
                }

                return(step.Execute(context, _onStepCompleted, out nextNode));
            }

            nextNode = null;
            FlowDecision decision = node as FlowDecision;

            if (decision != null)
            {
                if (_onDecisionCompleted == null)
                {
                    _onDecisionCompleted = new CompletionCallback <bool>(this.OnDecisionCompleted);
                }

                return(decision.Execute(context, _onDecisionCompleted));
            }

            IFlowSwitch switchNode = node as IFlowSwitch;

            Fx.Assert(switchNode != null, "unrecognized FlowNode");

            return(switchNode.Execute(context, this));
        }
コード例 #2
0
ファイル: Flowchart.cs プロジェクト: jimitndiaye/corewf
        private void OnDecisionCompleted(NativeActivityContext context, ActivityInstance completedInstance, bool result)
        {
            FlowDecision decision = this.GetCurrentNode(context) as FlowDecision;

            Fx.Assert(decision != null, "corrupt internal state");
            FlowNode next = result ? decision.True : decision.False;

            this.ExecuteNodeChain(context, next, completedInstance);
        }