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;

            }
        }


posted on 2011-01-06 12:57  rolends1986  阅读(418)  评论(0编辑  收藏  举报