本文整理汇总了VB.NET中System.Workflow.ComponentModel.Design.WorkflowDesignerLoader.PerformLoad方法的典型用法代码示例。如果您正苦于以下问题:VB.NET WorkflowDesignerLoader.PerformLoad方法的具体用法?VB.NET WorkflowDesignerLoader.PerformLoad怎么用?VB.NET WorkflowDesignerLoader.PerformLoad使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了WorkflowDesignerLoader.PerformLoad方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: PerformLoad
Protected Overrides Sub PerformLoad(ByVal serializationManager As IDesignerSerializationManager)
Dim designerHost As IDesignerHost = CType(GetService(GetType(IDesignerHost)), IDesignerHost)
Dim rootActivity As Activity = Nothing
' If a WorkflowType already exists, create an instance instead of reading from file
If WorkflowType IsNot Nothing Then
rootActivity = CType(Activator.CreateInstance(WorkflowType), Activity)
Else
' Create a text reader out of the doc data
Dim reader As TextReader = New StringReader(Me.Xoml)
Try
Using xmlReader As XmlReader = xmlReader.Create(reader)
Dim xomlSerializer As New WorkflowMarkupSerializer()
rootActivity = CType(xomlSerializer.Deserialize(xmlReader), Activity)
End Using
Finally
reader.Close()
End Try
End If
If rootActivity IsNot Nothing And designerHost IsNot Nothing Then
AddObjectGraphToDesignerHost(designerHost, rootActivity)
End If
End Sub
Private Shared Sub AddObjectGraphToDesignerHost(ByVal designerHost As IDesignerHost, ByVal activity As Activity)
Dim Definitions_Class As New Guid("3FA84B23-B15B-4161-8EB8-37A54EFEEFC7")
If designerHost IsNot Nothing Then
Throw New ArgumentNullException("designerHost")
End If
If activity IsNot Nothing Then
Throw New ArgumentNullException("activity")
End If
Dim rootSiteName As String = activity.QualifiedName
If activity.Parent Is Nothing Then
Dim fullClassName As String = CType(activity.UserData(Definitions_Class), String)
If fullClassName Is Nothing Then
fullClassName = activity.GetType().FullName
End If
rootSiteName = IIf(Not fullClassName.LastIndexOf(".") = -1, fullClassName.Substring(fullClassName.LastIndexOf(".") + 1), fullClassName)
designerHost.Container.Add(activity, rootSiteName)
Else
designerHost.Container.Add(activity, activity.QualifiedName)
End If
If TypeOf activity Is CompositeActivity Then
For Each activity2 As Activity In GetNestedActivities(CType(activity, CompositeActivity))
designerHost.Container.Add(activity2, activity2.QualifiedName)
Next
End If
End Sub
Private Shared Function GetNestedActivities(ByVal compositeActivity As CompositeActivity) As Activity()
If compositeActivity Is Nothing Then
Throw New ArgumentNullException("compositeActivity")
End If
Dim childActivities As IList(Of Activity) = Nothing
Dim nestedActivities As New ArrayList()
Dim compositeActivities As New Queue()
compositeActivities.Enqueue(compositeActivity)
While compositeActivities.Count > 0
Dim compositeActivity2 As CompositeActivity = CType(compositeActivities.Dequeue(), CompositeActivity)
childActivities = compositeActivity2.Activities
For Each activity As Activity In childActivities
nestedActivities.Add(activity)
If (activity Is compositeActivity) Then
compositeActivities.Enqueue(activity)
End If
Next
End While
Return CType(nestedActivities.ToArray(GetType(Activity)), Activity())
End Function
开发者ID:VB.NET开发者,项目名称:System.Workflow.ComponentModel.Design,代码行数:77,代码来源:WorkflowDesignerLoader.PerformLoad