当前位置: 首页>>代码示例>>C#>>正文


C# Variable.Get方法代码示例

本文整理汇总了C#中Variable.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Variable.Get方法的具体用法?C# Variable.Get怎么用?C# Variable.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Variable的用法示例。


在下文中一共展示了Variable.Get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateSubProcess

        /// <summary>
        /// 创建SubProcess子流程节点
        /// </summary>
        /// <param name="setting"></param>
        /// <param name="displayName"></param>
        /// <param name="serverScript">节点执行内容脚本</param>
        /// <param name="finishRule">节点完成规则</param>
        /// <param name="serverScriptResultTo">执行内容的结果输出到指定变量</param>
        /// <param name="serverResultTo">节点执行结果输出到变量</param>
        /// <param name="nexts"></param>
        /// <param name="defaultFlowNode"></param>
        /// <returns></returns>
        public static FlowStep CreateSubProcess(ActivitySetting setting
            , string displayName
            , IDictionary<string, string> finishRule
            , Variable<string> resultTo
            , IDictionary<string, FlowNode> nexts
            , FlowNode defaultFlowNode)
        {
            var server = CreateSubProcess(setting, displayName, finishRule, resultTo);
            var step = new FlowStep();
            step.Action = server;

            if (nexts == null && defaultFlowNode == null) return step;

            //设置finish cases
            var flowSwitch = new FlowSwitch<string>(o => resultTo.Get(o));
            if (defaultFlowNode != null)
                flowSwitch.Default = defaultFlowNode;
            if (nexts != null)
                nexts.ToList().ForEach(o => flowSwitch.Cases.Add(o.Key, o.Value));
            step.Next = flowSwitch;
            return step;
        }
开发者ID:jatinbhole,项目名称:NTFE-BPM,代码行数:34,代码来源:WorkflowBuilder.cs

示例2: CompensateWithNoTarget

        static Constraint CompensateWithNoTarget()
        {
            DelegateInArgument<Compensate> element = new DelegateInArgument<Compensate> { Name = "element" };
            DelegateInArgument<ValidationContext> validationContext = new DelegateInArgument<ValidationContext> { Name = "validationContext" };
            Variable<bool> assertFlag = new Variable<bool> { Name = "assertFlag" };
            Variable<IEnumerable<Activity>> elements = new Variable<IEnumerable<Activity>>() { Name = "elements" };
            Variable<int> index = new Variable<int>() { Name = "index" };

            return new Constraint<Compensate>
            {
                Body = new ActivityAction<Compensate, ValidationContext>
                {
                    Argument1 = element,
                    Argument2 = validationContext,
                    Handler = new Sequence
                    {
                        Variables = 
                        {
                            assertFlag,
                            elements,
                            index
                        },
                        Activities =
                        {
                            new If
                            {
                                Condition = new InArgument<bool>((env) => element.Get(env).Target != null),
                                Then = new Assign<bool>
                                {
                                    To = assertFlag,
                                    Value = true
                                },
                                Else = new Sequence
                                {
                                    Activities = 
                                    {
                                        new Assign<IEnumerable<Activity>>
                                        {
                                            To = elements,
                                            Value = new GetParentChain
                                            {
                                                ValidationContext = validationContext,
                                            },
                                        },
                                        new While(env => (assertFlag.Get(env) != true) && index.Get(env) < elements.Get(env).Count())
                                        {
                                            Body = new Sequence
                                            {
                                                Activities = 
                                                {
                                                    new If(env => (elements.Get(env).ElementAt(index.Get(env))).GetType() == typeof(CompensationParticipant))
                                                    {
                                                        Then = new Assign<bool>
                                                        {
                                                            To = assertFlag,
                                                            Value = true                                                            
                                                        },
                                                    },
                                                    new Assign<int>
                                                    {
                                                        To = index,
                                                        Value = new InArgument<int>(env => index.Get(env) + 1)
                                                    },
                                                }
                                            }
                                        }
                                    }
                                }                                
                            },
                            new AssertValidation
                            {
                                Assertion = new InArgument<bool>(assertFlag),
                                Message = new InArgument<string>(SR.CompensateWithNoTargetConstraint)   
                            }
                        }
                    }
                }
            };
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:79,代码来源:Compensate.cs

示例3: CreateHuman

        /// <summary>
        /// 创建人工节点
        /// </summary>
        /// <param name="setting"></param>
        /// <param name="displayName"></param>
        /// <param name="actioner"></param>
        /// <param name="humanResultTo"></param>
        /// <param name="nexts"></param>
        /// <param name="defaultFlowNode"></param>
        /// <returns></returns>
        public static FlowStep CreateHuman(ActivitySetting setting
            , string displayName
            , IActionersHelper actioner//Activity<string[]> actioner
            , Variable<string> humanResultTo
            , IDictionary<string, FlowNode> nexts
            , FlowNode defaultFlowNode)
        {
            var human = CreateHuman(setting, displayName, actioner, humanResultTo);
            var step = new FlowStep();
            step.Action = human;

            if (nexts == null && defaultFlowNode == null) return step;

            //设置finish cases
            //HACK:在进入switch之前就已经计算出任务结果
            var flowSwitch = new FlowSwitch<string>(o => humanResultTo.Get(o));
            if (defaultFlowNode != null)
                flowSwitch.Default = defaultFlowNode;
            if (nexts != null)
                nexts.ToList().ForEach(o => flowSwitch.Cases.Add(o.Key, o.Value));
            step.Next = flowSwitch;
            return step;
        }
开发者ID:jatinbhole,项目名称:NTFE-BPM,代码行数:33,代码来源:WorkflowBuilder.cs


注:本文中的Variable.Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。