Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microsoft Windows Workflow Foundation 4.0 Cookbook

You're reading from   Microsoft Windows Workflow Foundation 4.0 Cookbook Get the flexibility of Windows Workflow Foundation working for you. Based on a cookbook approach, this guide takes you through all the essential concepts with recipes you can apply or adapt to your own specific needs.

Arrow left icon
Product type Paperback
Published in Sep 2010
Publisher Packt
ISBN-13 9781849680783
Length 272 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Andrew Zhu Andrew Zhu
Author Profile Icon Andrew Zhu
Andrew Zhu
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Microsoft Windows Workflow Foundation 4.0 Cookbook
Credits
About the Author
About the Reviewers
Foreword
Preface
1. Workflow Program FREE CHAPTER 2. Built-in Flow Control Activities 3. Messaging and Transaction 4. Manipulating Collections 5. Custom Activities 6. WF4 Extensions 7. Hosting Workflow Applications 8. Custom Workflow Designer Index

Using CancellationScope activity


As we know, the Parallel activity will not finish execution until all of its child branches have finished execution. Sometimes, we want to break the parallel if one of its branch finishes execution and cancel the other branches. To do this, we can use a CancellationScope activity. In this task, we want to order products from two dealers (Dealer A and Dealer B) at the same time. In this situation, the two dealers are in a competition, and so the one who ships the product faster wins the business.

How to do it...

  1. Create a Workflow Console Application:

    Create a new Workflow Console Application project and name it UseCancellationScope.

  2. Create a code workflow file:

    Add to the project a new class file and name it WorkflowWithCancellationScope.cs. Fill the file with the following code:

    using System.Activities;
    using System.Activities.Statements;
    using System;
    namespace UseCancellationScope {
        class WorkflowWithCancellationScope {
            public Activity GetInstance...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image