다음을 통해 공유


Activity.RaiseEvent(DependencyProperty, Object, EventArgs) 메서드

정의

지정된 종속성 속성과 연결된 Event를 발생시킵니다.

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)

매개 변수

dependencyEvent
DependencyProperty

DependencyProperty와 연결된 Event입니다.

sender
Object

ObjectEvent 소스입니다.

e
EventArgs

EventArgs와 연결된 Event입니다.

예제

다음 코드는 이 메서드를 호출하여 로 정의된 DependencyProperty이벤트를 발생합니다.

이 코드 예제는 전자 메일 보내기 작업 샘플의 일부이며 SendEmailActivity.cs 파일에서 가져옵니다. 자세한 내용은 전자 메일 보내기 작업 샘플을 참조하세요.

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

적용 대상