ActivityToolboxItem 构造函数

定义

初始化 ActivityToolboxItem 类的新实例。

重载

ActivityToolboxItem()

初始化 ActivityToolboxItem 类的新实例。

ActivityToolboxItem(Type)

初始化 ActivityToolboxItem 类的新实例,它将创建指定类型的 Activity 组件。

ActivityToolboxItem(SerializationInfo, StreamingContext)

使用指定的 ActivityToolboxItemSerializationInfo 初始化 StreamingContext 类的新实例。

ActivityToolboxItem()

初始化 ActivityToolboxItem 类的新实例。

public:
 ActivityToolboxItem();
public ActivityToolboxItem ();
Public Sub New ()

注解

类的 ActivityToolboxItem 无参数构造函数。

适用于

ActivityToolboxItem(Type)

初始化 ActivityToolboxItem 类的新实例,它将创建指定类型的 Activity 组件。

public:
 ActivityToolboxItem(Type ^ type);
public ActivityToolboxItem (Type type);
new System.Workflow.ComponentModel.Design.ActivityToolboxItem : Type -> System.Workflow.ComponentModel.Design.ActivityToolboxItem
Public Sub New (type As Type)

参数

type
Type

工具箱项将创建的 Activity 的类型。

适用于

ActivityToolboxItem(SerializationInfo, StreamingContext)

使用指定的 ActivityToolboxItemSerializationInfo 初始化 StreamingContext 类的新实例。

protected:
 ActivityToolboxItem(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected ActivityToolboxItem (System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Workflow.ComponentModel.Design.ActivityToolboxItem : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Workflow.ComponentModel.Design.ActivityToolboxItem
Protected Sub New (info As SerializationInfo, context As StreamingContext)

参数

info
SerializationInfo

保存用于反序列化工具箱项的信息的 SerializationInfo

context
StreamingContext

为工具箱项提供反序列化上下文的 StreamingContext

示例

下面的示例演示了自定义活动的完整的 ActivityToolboxItem 类。 将在构造函数中调用 Deserialize 方法,以便初始化 ActivityToolboxItem 的新实例。

[Serializable]
internal sealed class CustomActivityToolboxItem : ActivityToolboxItem
{
    public CustomActivityToolboxItem(Type type)
        : base(type)
    {
    }

    private CustomActivityToolboxItem(SerializationInfo info, StreamingContext context)
    {
        Deserialize(info, context);
    }

    protected override IComponent[] CreateComponentsCore(IDesignerHost designerHost)
    {
        CompositeActivity parallel = new ParallelActivity();
        parallel.Activities.Add(new CustomActivity());
        parallel.Activities.Add(new CustomActivity());

        return new IComponent[] { parallel };
    }
}
<Serializable()> _
Friend Class CustomActivityToolboxItem
    Inherits ActivityToolboxItem

    Public Sub New(ByVal type As Type)
        MyBase.new(type)
    End Sub

    Private Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)
        Deserialize(info, context)
    End Sub

    Protected Overrides Function CreateComponentsCore(ByVal designerHost As IDesignerHost) As IComponent()
        Dim parallel As New ParallelActivity()
        parallel.Activities.Add(New CustomActivity())
        parallel.Activities.Add(New CustomActivity())

        Return New IComponent() {parallel}
    End Function
End Class

注解

调用 ActivityToolboxItem 时,它将反序列化工具箱项。

适用于