0
你好我創建與C#4.0 WWF工作流程,我遇到了一些問題:工作流程連接顯示奇怪
我的測試代碼:
Flowchart flow = new Flowchart
{
DisplayName = "Test",
StartNode = new FlowSwitch<String> { Expression = "[prop1]" },
Variables = { new Variable<String> { Name = "prop1" } },
};
FlowNode MySwitch = flow.StartNode;
flow.Nodes.Add(MySwitch);
我保存它:
StreamWriter sw = File.CreateText(@"../../test.xaml");
var xmlWriter = XmlWriter.Create(sw,
new XmlWriterSettings { Indent = true, OmitXmlDeclaration = false });
using (xmlWriter)
{
var xamlXmlWriter = new XamlXmlWriter(xmlWriter, new XamlSchemaContext());
using (xamlXmlWriter)
{
XamlWriter xamlWriter = ActivityXamlServices.CreateBuilderWriter(xamlXmlWriter);
using (xamlWriter)
{
var activityBuilder = new ActivityBuilder { Name = "Test", Implementation = Workflow };
XamlServices.Save(xamlWriter, activityBuilder);
}
}
}
sw.Close();
,然後我得到這個XAML:
<?xml version="1.0" encoding="utf-8"?>
<Activity x:Class="Test" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Flowchart DisplayName="Test">
<Flowchart.Variables>
<Variable x:TypeArguments="x:String" Name="prop1" />
</Flowchart.Variables>
<Flowchart.StartNode>
<x:Reference>__ReferenceID0</x:Reference>
</Flowchart.StartNode>
<FlowSwitch x:TypeArguments="x:String" x:Name="__ReferenceID0" Expression="[prop1]" />
</Flowchart>
</Activity>
,當我在Visual Studio中加載它,我得到這個工作流程:
我認爲這是錯誤的,因爲從「開始」節點開始弧應該是下面的框中,而不是結束!
如果我添加其他步驟,他們都只使用超過位置連接。
我在做什麼錯了?
老實說,你不需要在標題中加標籤。你已經擁有了他們所屬的地方*。另外,我認爲你沒有做錯什麼;編輯只是沒有就繪製連接線的地方做出正確的決定。只需打開一個連接並要求他們修復其佈局邏輯。 – Will