Share via


ReplicatorActivity.ChildInitialized Événement

Définition

Se produit immédiatement après l'initialisation d'une activité enfant.

public:
 event EventHandler<System::Workflow::Activities::ReplicatorChildEventArgs ^> ^ ChildInitialized;
public event EventHandler<System.Workflow.Activities.ReplicatorChildEventArgs> ChildInitialized;
member this.ChildInitialized : EventHandler<System.Workflow.Activities.ReplicatorChildEventArgs> 
Public Custom Event ChildInitialized As EventHandler(Of ReplicatorChildEventArgs) 

Type d'événement

Exemples

L'exemple de code suivant illustre la manière de définir la valeur de l'événement ChildInitialized. Cet exemple de code fait partie de l'exemple du Kit de développement logiciel Replicator (SDK) du fichier SimpleReplicatorWorkflow.Designer.cs. Pour plus d’informations, consultez Utilisation du réplicaur.

public sealed partial class ThrowWorkflow : SequentialWorkflowActivity
{
    [System.Diagnostics.DebuggerNonUserCode()]
    private void InitializeComponent()
    {
        this.CanModifyActivities = true;
        System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
        this.throwActivity1 = new System.Workflow.ComponentModel.ThrowActivity();
        activitybind1.Name = "ThrowWorkflow";
        activitybind1.Path = "ThrownException";
        //
        // throwActivity1
        //
        this.throwActivity1.Name = "throwActivity1";
        this.throwActivity1.SetBinding(System.Workflow.ComponentModel.ThrowActivity.FaultProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
        //
        // ThrowWorkflow
        //
        this.Activities.Add(this.throwActivity1);
        this.Name = "ThrowWorkflow";
        this.CanModifyActivities = false;
    }

    private Exception thrownExceptionValue = new System.Exception("My Exception Message.");

    public Exception ThrownException
    {
        get { return thrownExceptionValue; }
        set { thrownExceptionValue = value; }
    }

    private ThrowActivity throwActivity1;
}
Partial Public NotInheritable Class ThrowWorkflow
    Inherits SequentialWorkflowActivity

    <System.Diagnostics.DebuggerNonUserCode()> _
                                        Private Sub InitializeComponent()

        Me.CanModifyActivities = True
        Dim activitybind1 As New System.Workflow.ComponentModel.ActivityBind()
        Me.throwActivity1 = New System.Workflow.ComponentModel.ThrowActivity()
        activitybind1.Name = "ThrowWorkflow"
        activitybind1.Path = "ThrownException"
        ' 
        ' throwActivity1
        ' 
        Me.throwActivity1.Name = "throwActivity1"
        Me.throwActivity1.SetBinding(System.Workflow.ComponentModel.ThrowActivity.FaultProperty, activitybind1)
        ' 
        ' ThrowWorkflow
        ' 
        Me.Activities.Add(Me.throwActivity1)
        Me.Name = "ThrowWorkflow"
        Me.CanModifyActivities = False

    End Sub

    Private thrownExceptionValue As New System.Exception("My Exception Message.")

    Public Property ThrownException() As Exception
        Get
            Return thrownExceptionValue
        End Get
        Set(ByVal value As Exception)
            thrownExceptionValue = value
        End Set
    End Property

    Private throwActivity1 As ThrowActivity

End Class

Remarques

Si vous y êtes abonné, cet événement est déclenché chaque fois qu’une instance de l’activité enfant est créée pour un élément dans la collection Children. La collection Children est définie via le ReplicatorChildEventArgs du gestionnaire d'événements Initialized. L'instance enfantActivity est passée dans l'appel afin que le ReplicatorActivity soit en mesure d'attribuer des valeurs à l'enfant. L’objet InstanceData pertinent de la collection Children est également passé.

S’applique à

Voir aussi