Activity.RaiseEvent(DependencyProperty, Object, EventArgs) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Déclenche un Event associé à la propriété de dépendance spécifiée.
protected public:
void RaiseEvent(System::Workflow::ComponentModel::DependencyProperty ^ dependencyEvent, System::Object ^ sender, EventArgs ^ e);
protected internal void RaiseEvent (System.Workflow.ComponentModel.DependencyProperty dependencyEvent, object sender, EventArgs e);
member this.RaiseEvent : System.Workflow.ComponentModel.DependencyProperty * obj * EventArgs -> unit
Protected Friend Sub RaiseEvent (dependencyEvent As DependencyProperty, sender As Object, e As EventArgs)
Paramètres
- dependencyEvent
- DependencyProperty
DependencyProperty associé à ce Event.
Exemples
Le code suivant appelle cette méthode pour déclencher un événement défini comme un DependencyProperty.
Cet exemple de code fait partie de l’exemple d’activité Envoyer un e-mail et provient du fichier SendEmailActivity.cs. Pour plus d’informations, consultez l’exemple d’activité Envoyer un e-mail
protected override ActivityExecutionStatus Execute(ActivityExecutionContext context)
{
try
{
// Raise the SendingEmail event to the parent workflow or activity
base.RaiseEvent(SendEmailActivity.SendingEmailEvent, this, EventArgs.Empty);
// Send the email now
this.SendEmailUsingSmtp();
// Raise the SentEmail event to the parent workflow or activity
base.RaiseEvent(SendEmailActivity.SentEmailEvent, this, EventArgs.Empty);
// Return the closed status indicating that this activity is complete.
return ActivityExecutionStatus.Closed;
}
catch
{
// An unhandled exception occurred. Throw it back to the WorkflowRuntime.
throw;
}
}
Protected Overrides Function Execute(ByVal context As ActivityExecutionContext) As ActivityExecutionStatus
Try
' Raise the SendingEmail event to the parent workflow or activity
MyBase.RaiseEvent(SendEmailActivity.SendingEmailEvent, Me, EventArgs.Empty)
' Send the email now
Me.SendEmailUsingSmtp()
' Raise the SentEmail event to the parent workflow or activity
MyBase.RaiseEvent(SendEmailActivity.SentEmailEvent, Me, EventArgs.Empty)
' Return the closed status indicating that this activity is complete.
Return ActivityExecutionStatus.Closed
Catch
' An unhandled exception occurred. Throw it back to the WorkflowRuntime.
Throw
End Try
End Function