共用方式為


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 時,它會將工具箱項目還原序列化。

適用於