Επεξεργασία

Κοινή χρήση μέσω


ActivityToolboxItem Constructors

Definition

Initializes a new instance of the ActivityToolboxItem class.

Overloads

ActivityToolboxItem()

Initializes a new instance of the ActivityToolboxItem class.

ActivityToolboxItem(Type)

Initializes a new instance of the ActivityToolboxItem class that creates the specified type of Activity component.

ActivityToolboxItem(SerializationInfo, StreamingContext)

Initializes a new instance of the ActivityToolboxItem class by using the specified SerializationInfo and StreamingContext.

ActivityToolboxItem()

Initializes a new instance of the ActivityToolboxItem class.

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

Remarks

The parameterless constructor for the ActivityToolboxItem class.

Applies to

ActivityToolboxItem(Type)

Initializes a new instance of the ActivityToolboxItem class that creates the specified type of Activity component.

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)

Parameters

type
Type

The type of the Activity that the toolbox item will create.

Applies to

ActivityToolboxItem(SerializationInfo, StreamingContext)

Initializes a new instance of the ActivityToolboxItem class by using the specified SerializationInfo and 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)

Parameters

info
SerializationInfo

The SerializationInfo that holds information to deserialize the toolbox item.

context
StreamingContext

The StreamingContext that provides the deserialization context for the toolbox item.

Examples

The following example shows a complete ActivityToolboxItem class for a custom activity. The Deserialize method is called within the constructor in order to initialize a new instance of the 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

Remarks

When ActivityToolboxItem is called, it deserializes the toolbox item.

Applies to