WF Activity得到Variable and Argument(2)

本文介绍了一种处理 Flowchart 中参数与节点的方法,通过遍历 ActivityBuilder 的属性及 Flowchart 的变量来构建参数字典,并筛选出与当前 FlowNode 相关的父节点。
 
public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
        {
            ConditionWindow conWnd 
= new ConditionWindow();
            ModelPropertyEntryToOwnerActivityConverter converter 
= new ModelPropertyEntryToOwnerActivityConverter();
            ModelItem modelItem 
= (ModelItem)converter.Convert(propertyValue.ParentProperty, typeof(ModelItem), falsenull);
            
if (modelItem.Root.GetCurrentValue() is System.Activities.ActivityBuilder)
            {
                var aber 
= (modelItem.Root.GetCurrentValue() as System.Activities.ActivityBuilder);
                Dictionary
<string, Type> parameters = new Dictionary<string, Type>();
                
if (aber.Properties != null)
                {
                    
foreach (var pro in aber.Properties)
                    {
                        parameters.Add(pro.Name, pro.Type.GetGenericArguments()[
0]);
                    }
                }
                
if (aber.Implementation is System.Activities.Statements.Flowchart)
                {
                    var fc 
= aber.Implementation as System.Activities.Statements.Flowchart;
                    
if (fc.Variables != null)
                    {
                        
foreach (var va in fc.Variables)
                        {
                            parameters.Add(va.Name, va.Type);
                        }
                    }
                    XQSOFT.WF.BLL.Flow bllFlow 
= new WF.BLL.Flow();
                    var nodes 
= fc.Nodes.ToList();
                    var parents 
= bllFlow.GetGoEndByCurrent(nodes, fc.StartNode, modelItem.GetCurrentValue() as System.Activities.Statements.FlowNode);
                    conWnd.Nodes 
= parents;
                    conWnd.Parameters 
= parameters;
                }
            }

            
if (conWnd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                propertyValue.Value 
= conWnd.CurrentActivity;

            }
        }


转载于:https://www.cnblogs.com/Rolends/archive/2011/01/06/1927595.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值