Using the Delay Activity

We’ve seen and used the Delay activity a few times so far in the book, but I’ve saved a more formal description until this point. Why? As it happens, the Delay activity implements the IEventActivity interface. Because of this, it’s also classified as a Windows Workflow Foundation (WF) event-based activity.

The premise is simple: hand Delay a TimeSpan object, and it will delay for that duration of time. After the time duration expires, it will fire an event. You can initialize the time duration by setting a property (TimeoutDuration) in the Visual Studio visual workflow designer, or you can set it programmatically. There is also an event handler (InitializeTimeoutDuration) you can provide that is called upon when the Delay ...

Get Microsoft® Windows® Workflow Foundation Step by Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.