Skip to Content
Microsoft Windows Workflow Foundation 4.0 Cookbook
book

Microsoft Windows Workflow Foundation 4.0 Cookbook

by Andrew Zhu
September 2010
Intermediate to advanced content levelIntermediate to advanced
272 pages
5h 16m
English
Packt Publishing
Content preview from Microsoft Windows Workflow Foundation 4.0 Cookbook

Creating an activity by inheriting the root activity

The abstract Activity class is the root of all subactivity classes. In this task, we will create a custom activity inheriting directly from Activity.

How to do it...

  1. Customize an Activity:

    Add a new code file MyActivity.cs in the ActivityLibrary project, and fill the file with the following code:

    using System;
    using System.Activities;
    using System.Activities.Statements;
    public class MyActivity:Activity {
        public MyActivity() {
            this.Implementation = () => new Sequence {
                Activities = {
                    new WriteLine(){Text="Hello MyActivity"}
                }
            };
        }
    }

    Then build the activity project so that MyActivity appears in the toolbox panel of the workflow designer.

  2. Add a reference to ActivityLibrary:

    In the WorkflowConsoleApp ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Essential Windows Workflow Foundation

Essential Windows Workflow Foundation

Dharma Shukla, Bob Schmidt

Publisher Resources

ISBN: 9781849680783Other