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

A number guessing game in Sequence


In this task, we will create a guess number game in the Sequence activity. This task will also demonstrate the usage of the DoWhile and IfElse activities.

How to do it...

  1. Create a workflow project:

    Create a Workflow Console Application and name it GuessNumberGameInSequence.

  2. Create a ReadNumberActivity to receive your guess number:

    Create a new code file, name it ReadNumberActivity.cs, and fill the file with the following code:

    using System;
    using System.Activities;
    namespace GuessNumberGameInSequence {
        public sealed class ReadNumberActivity : CodeActivity {
            public OutArgument<int> OutNumber { get; set; }
            protected override void Execute(CodeActivityContext context) {
                OutNumber.Set(context, Int32.Parse(Console.ReadLine()));
            }
        }
    }

    Save and build the project so that we can use this activity in workflow designer.

  3. Author a workflow:

    Open Workflow1.xaml in workflow designer. Author the workflow as shown in the...

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