Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
DelayActivity Class
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
DelayActivity Class

Provides the logic to establish a timer and to wait, asynchronously, for timer's expiration. This class cannot be inherited.

Namespace:  System.Workflow.Activities
Assembly:  System.Workflow.Activities (in System.Workflow.Activities.dll)
Visual Basic (Declaration)
<ToolboxBitmapAttribute(GetType(DelayActivity), "Resources.Delay.png")> _
Public NotInheritable Class DelayActivity _
    Inherits Activity _
    Implements IEventActivity, IActivityEventListener(Of QueueEventArgs)
Visual Basic (Usage)
Dim instance As DelayActivity
C#
[ToolboxBitmapAttribute(typeof(DelayActivity), "Resources.Delay.png")]
public sealed class DelayActivity : Activity, 
    IEventActivity, IActivityEventListener<QueueEventArgs>
Visual C++
[ToolboxBitmapAttribute(typeof(DelayActivity), L"Resources.Delay.png")]
public ref class DelayActivity sealed : public Activity, 
    IEventActivity, IActivityEventListener<QueueEventArgs^>
JScript
public final class DelayActivity extends Activity implements IEventActivity, IActivityEventListener<QueueEventArgs>

When notified that its timer has expired, a DelayActivity completes its execution.

You can set a time out on the DelayActivity so that your workflow pauses before resuming execution. You specify the TimeoutDuration using TimeSpan. This causes your workflow to pause until the specified TimeSpan has elapsed.

The DelayActivity class runs the code method associated with the InitializeTimeoutDuration event before the activity starts and the code-beside method can be used to initialize the TimeoutDuration property.

The DelayActivity is guaranteed to complete no sooner than the indicated TimeoutDuration. The delay can take longer because the timer notification might occur some time after the TimeoutDuration is reached. One reason for a longer delay is if the workflow is running under high system stress in a server environment.

The following code example demonstrates how to create a new instance of the DelayActivity class. This code example is part of the SimpleStateMachineWorkflow SDK Sample from the StateMachineWorkflow.cs file. For more information, see Simple State Machine.

Visual Basic
Me.StartState = New System.Workflow.Activities.StateActivity()
C#
this.StartState = new System.Workflow.Activities.StateActivity();
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker