IfElseActivity
IfElseActivity
1.IfElseActivity有两个IfElseBranch子控件,分别作为IfElse的两个分支容器,系统自动添加,
2.其中左边(为真件条)的IfElseBranch容器要设Condition
3.IfElse左边(为真件条)的IfElseBranch容器的Condition有两个条件模式:Code Condition,Declarative Rule Condition
Code Condition模式
Code Condition模式,由对e.Result赋不同值决定执行不同的分支
要使用该模式,会在代码中用到CodeCondition对象与CodeCondition对象的Condition事件![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
双击无法进入代码,可手写该过程,
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Declarative Rule Condition模式
Declarative Rule Condition模式:由指定的表达式的值是否符合条件定执行不同的分支
代码实现
Workflow1.rules |
<RuleDefinitions xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow"> <RuleDefinitions.Conditions> <RuleExpressionCondition Name="Condition1"> <RuleExpressionCondition.Expression> <ns0:CodeBinaryOperatorExpression Operator="ValueEquality" xmlns:ns0="clr-namespace:System.CodeDom;Assembly=System, Version= <ns0:CodeBinaryOperatorExpression.Left> <ns0:CodeFieldReferenceExpression FieldName="temp"> <ns0:CodeFieldReferenceExpression.TargetObject> <ns0:CodeThisReferenceExpression /> </ns0:CodeFieldReferenceExpression.TargetObject> </ns0:CodeFieldReferenceExpression> </ns0:CodeBinaryOperatorExpression.Left> <ns0:CodeBinaryOperatorExpression.Right> <ns0:CodePrimitiveExpression> <ns0:CodePrimitiveExpression.Value> <ns1:String xmlns:ns1="clr-namespace:System;Assembly=mscorlib, Version= </ns0:CodePrimitiveExpression.Value> </ns0:CodePrimitiveExpression> </ns0:CodeBinaryOperatorExpression.Right> </ns0:CodeBinaryOperatorExpression> </RuleExpressionCondition.Expression> </RuleExpressionCondition> </RuleDefinitions.Conditions> </RuleDefinitions> |
Dim ruleconditionreference1 As Workflow.Activities.Rules.RuleConditionReference = New .RuleConditionReference ruleconditionreference1.ConditionName = "Condition1" Me.ifElseBranchActivity3.Condition = ruleconditionreference1 |