WorkflowDesignerLoader.AddActivityToDesigner(Activity) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds an activity to the designer host after it has been added to the parent activities collection.
public:
void AddActivityToDesigner(System::Workflow::ComponentModel::Activity ^ activity);
public void AddActivityToDesigner (System.Workflow.ComponentModel.Activity activity);
member this.AddActivityToDesigner : System.Workflow.ComponentModel.Activity -> unit
Public Sub AddActivityToDesigner (activity As Activity)
Parameters
Examples
The following example demonstrates how to add a CodeActivity to the designer. Before the activity is added to the designer using the AddActivityToDesigner method, it is first added to the Activities collection of the root activity within the workflow.
public void AddCodeActivityToDesigner()
{
WorkflowDesignerLoader loader = GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;
if (loader == null)
return;
IDesignerHost designerHost = (IDesignerHost)GetService(typeof(IDesignerHost));
CompositeActivity rootActivity = designerHost.RootComponent as CompositeActivity;
CodeActivity codeActivity = new CodeActivity();
rootActivity.Activities.Add(codeActivity);
loader.AddActivityToDesigner(codeActivity);
return;
}
Public Sub AddCodeActivityToDesigner()
Dim loader As WorkflowDesignerLoader = CType(GetService(GetType(WorkflowDesignerLoader)), WorkflowDesignerLoader)
If loader Is Nothing Then Return
Dim designerHost As IDesignerHost = CType(GetService(GetType(IDesignerHost)), IDesignerHost)
Dim rootActivity As CompositeActivity = CType(designerHost.RootComponent, CompositeActivity)
Dim codeActivity As New CodeActivity()
rootActivity.Activities.Add(codeActivity)
loader.AddActivityToDesigner(codeActivity)
Return
End Sub
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET