我想通过从SQL表中获取数据来构建带有自定义标记的DGML。
表格:
UCId UCPre UCPost UCNext
-----------------------------------------------------------------------------------------------
UC01 User must be Registerd User is Loggined sucessfully UC02
UC02 User is Loggined sucessfully User is added UC03
UC03 File must be selected File is added NULL
UC04 File is added File is deleted NULL
UC05 User is Loggined sucessfully User is deleted NULL
我想在我希望从UCID列和UCNext列读取UCId的节点中使用以下标记的xml
<?xml version="1.0" encoding="utf-8"?>
<DirectedGraph Title="TestT" xmlns="http://schemas.microsoft.com/vs/2009/dgml">
<Nodes>
<Node Id="UC01" Label="UC01" />
<Node Id="UC02" Label="UC02" />
<Node Id="UC03" Label="UC03" />
</Nodes>
我希望根据以上数据在节点之间建立节点之间的链接为UC01,下一个状态是UC02。如何通过编码设置它以便在节点之间创建正确的链接
<Links>
<Link Source="UC01" Target="UC02" Label="1"/>
<Link Source="UC02" Target="UC03" Label="2" />
</Links>
<Properties>
<Property Id="Background" Label="Background" Description="The background color" DataType="System.Windows.Media.Brush" />
<Property Id="Bounds" DataType="System.Windows.Rect" />
<Property Id="Label" Label="Label" Description="Displayable label of an Annotatable object" DataType="System.String" />
<Property Id="LabelBounds" DataType="System.Windows.Rect" />
<Property Id="Stroke" DataType="System.Windows.Media.Brush" />
<Property Id="Title" DataType="System.String" />
<Property Id="UseManualLocation" DataType="System.Boolean" />
</Properties>
</DirectedGraph>
我怎样才能通过c#或java来帮助你呢?
答案 0 :(得分:0)
请参阅此代码示例:https://gist.github.com/azukipochette/4644291
步骤1:遍历所有记录以创建节点。
步骤2:再次遍历所有记录以创建链接(通过标签查找在步骤1中创建的节点对)。