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), false, null);
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;
}
}
{
ConditionWindow conWnd = new ConditionWindow();
ModelPropertyEntryToOwnerActivityConverter converter = new ModelPropertyEntryToOwnerActivityConverter();
ModelItem modelItem = (ModelItem)converter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null);
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;
}
}
转载请注明:http://www.cnblogs.com/Rolends
HAPPY EVERY DAY ! !