【问题标题】:WF4 state machine rehosting: FinalStateWF4 状态机重新托管:FinalState
【发布时间】:2012-07-16 06:48:21
【问题描述】:
我正在重新托管 WF4 工作流设计器。
对于状态机,我不知道如何在 XAML 中通过 sapt:ToolboxItemWrapper 提供“FinalState”。
没有 FinalState 类,只有“常规”状态的 State 类。 State 类有一个 IsFinal 属性,所以我想它必须设置才能成为“FinalState”。
我尝试从 State 派生我自己的 FinalState 类,该类将在构造函数中设置 IsFinal,但由于 State 是密封的,所以它不起作用。
那么如何从 XAML 提供 FinalState?
【问题讨论】:
标签:
workflow-foundation-4
state-machine
rehosting
【解决方案1】:
实际上是一个 FinalState 类,只是在不同的程序集中。所以添加状态机使用:
<Window.Resources>
<sys:String x:Key="AssemblyName">System.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</sys:String>
<sys:String x:Key="SACPAssemblyName">System.Activities.Core.Presentation, Version=4.0.0.0, Culture=neutral, PublicKeyToken="31bf3856ad364e35"</sys:String>
</Window.Resources>
<sapt:ToolboxCategory CategoryName="State Machine">
<sapt:ToolboxItemWrapper AssemblyName="{StaticResource AssemblyName}">
<sapt:ToolboxItemWrapper.ToolName>
System.Activities.Statements.Statemachine
</sapt:ToolboxItemWrapper.ToolName>
</sapt:ToolboxItemWrapper>
<sapt:ToolboxItemWrapper AssemblyName="{StaticResource AssemblyName}">
<sapt:ToolboxItemWrapper.ToolName>
System.Activities.Statements.State
</sapt:ToolboxItemWrapper.ToolName>
</sapt:ToolboxItemWrapper>
<sapt:ToolboxItemWrapper AssemblyName="{StaticResource SACPAssemblyName}">
<sapt:ToolboxItemWrapper.ToolName>
System.Activities.Core.Presentation.FinalState
</sapt:ToolboxItemWrapper.ToolName>
</sapt:ToolboxItemWrapper>
</sapt:ToolboxCategory>