Activity.RaiseEvent(DependencyProperty, Object, EventArgs) Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Gera um Event associado à propriedade de dependência especificada.
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)
Parâmetros
- dependencyEvent
- DependencyProperty
O DependencyProperty associado a este Event.
Exemplos
O código a seguir invoca esse método para gerar um evento definido como um DependencyProperty.
Este exemplo de código faz parte do exemplo de Atividade de Envio de Email e é do arquivo SendEmailActivity.cs. Para obter mais informações, consulte Enviar exemplo de atividade de email
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