zoukankan      html  css  js  c++  java
  • 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事件



        'Code Condition模式的判断,由对e.Result赋不同值决定执行不同的分支
     Private Sub ifElse_a_Condition(ByVal sender As System.Object, ByVal e As System.Workflow.Activities.ConditionalEventArgs)
            
    'e.Result如果为真,就执行左边(为真件条)的IfElseBranch容器
            'e.Result如果为假,就执行右边(为假件条)的IfElseBranch容器
            If temp = "456" Then
                e.Result 
    = True
            
    Else
                e.Result 
    = False
            
    End If
        
    End Sub

    双击无法进入代码,可手写该过程,

    从下拉框绑定时如报错,可在Workflow1.designer.vb中的手写绑定代码
    'Workflow1.designer.vb中的绑定代码
    Dim codecondition1 As System.Workflow.Activities.CodeCondition = New System.Workflow.Activities.CodeCondition
    AddHandler codecondition1.Condition, AddressOf Me.ifElse_a_Condition
    Me.ifElseBranchActivity1.Condition = codecondition1

     

    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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

                           <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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">123</ns1:String>

                                     </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

     

  • 相关阅读:
    Oracle数据库管理员经常使用的表和视图
    oracle重建、更新索引、索引统计信息命令
    oracle查看死锁和处理方法
    2013秋季校招,你准备好了吗?
    oracle:变长数组varray,嵌套表,集合
    HTTPS是如何保证连接安全:每位Web开发者都应知道的
    CTE在Oracle和Sqlserver中使用的差异
    NUll在oracle与sqlserver中使用相同与区别
    linux中history命令使用与配置
    权限访问控制设计
  • 原文地址:https://www.cnblogs.com/foundation/p/516366.html
Copyright © 2011-2022 走看看