Export (0) Print
Expand All

Activity.RaiseEvent Method

Raises an Event associated with the specified dependency property.

Namespace:  System.Workflow.ComponentModel
Assembly:  System.Workflow.ComponentModel (in System.Workflow.ComponentModel.dll)

protected internal void RaiseEvent(
	DependencyProperty dependencyEvent,
	Object sender,
	EventArgs e
)

Parameters

dependencyEvent
Type: System.Workflow.ComponentModel.DependencyProperty

The DependencyProperty associated with this Event.

sender
Type: System.Object

The Object source of the Event.

e
Type: System.EventArgs

The EventArgs associated with the Event.

The following code invokes this method to raise an event that is defined as a DependencyProperty.

This code example is part of the Send E-mail Activity sample and is from the SendEmailActivity.cs file. For more information, see Send E-mail Activity Sample

        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;
            }
        }

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft