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
Bekerjasama dengan kami di GitHub
Sumber untuk kandungan ini boleh didapati di GitHub, di mana anda juga boleh mencipta dan menyemak isu dan menarik permintaan. Untuk maklumat lanjut, lihat panduan penyumbang kami.