Partilhar via


Windows Workflow Foundation Samples

The samples in this section cover a wide range of technology areas in Windows Workflow Foundation. The technology samples focus on key areas of Windows Workflow Foundation, whereas the application samples demonstrate a variety of Windows Workflow Foundation features through the use of complete applications.

In This Section

Application Samples

The Application samples represent complete applications that are written for Windows Workflow Foundation that demonstrate the use of several technologies.

Sample Description

Ordering State Machine Sample

Demonstrates how to create a state machine workflow that implements an order-processing system.

Outlook Workflow Wizard Sample

Demonstrates how to host the Windows Workflow Foundation Visual Studio designer to create an application that generates rules for Microsoft Office Outlook.

Speech Application Sample

Demonstrates how to create a state machine workflow that implements a speech-driven menu application.

Termination Tracking Service Sample

Demonstrates how to create a custom tracking service to track workflow terminations.

Tracking Profile Designer Sample

Enables you to visually create a tracking profile. This tracking profile can then be saved to a file or a database in SQL Server.

Workflow Monitor Sample

Provides a tool that lets you see the progress of a workflow instance. It uses the SqlTrackingService to gather the current status of the workflow and activities, and it uses the rehostable workflow designer to show progress.

Workflow Reflection Utility Sample

Provides an extensible tool for extracting workflow-related information from an assembly. Each workflow's hierarchy, declarative rules, and required local services are displayed in a tree view. This allows for easy browsing of the compiled workflow's structure.

Technology Samples

The Technology samples demonstrate specific technologies of Windows Workflow Foundation. They are categorized based on their technology features.

Category Sample Description

Activities Samples

Nested Exception Handlers Sample

Illustrates how to use nested exception handlers in a workflow to catch and handle specific exception types at different stages in the workflow.

Delay Sample

Demonstrates the use of the DelayActivity activity.

While and Parallel Sample

Demonstrates the use of two parallel sequential code activities within a while loop activity.

Suspend and Terminate Sample

Demonstrates the use of the two basic activities, SuspendActivity and TerminateActivity.

Replicator Sample

Demonstrates a simple use of the ReplicatorActivity activity.

ConditionedActivityGroup Sample

Provides a simple implementation of a ConditionedActivityGroup (CAG) activity.

Synchronized Sample

Demonstrates how to author a workflow that synchronizes access to shared resources.

Throw Sample

Illustrates how to use the Throw activity, which enables you to model and throw an exception from a workflow. It also shows how to catch the exception in the hosting application.

Compensation Sample

Demonstrates how to author compensation in a workflow.

Simple Policy Sample

Shows how to create a workflow that uses the PolicyActivity to implement a discount workflow.

Advanced Policy Sample

Builds on the Simple Policy Sample sample to show more advanced capabilities available with a RuleSet.

State Initialization Sample

Shows how to use a State Initialization activity.

Activity Binding Samples

Custom Activity Binding Sample

Includes a workflow that has a custom activity property that is bound to a workflow property.

Basic Workflows Samples

Simple Sequential Workflow Sample

Illustrates how to build and execute a "hello world" workflow by using a command-line host.

Simple State Machine Sample

Demonstrates the use of state machine workflow.

Workflow with Parameters Sample

Shows how to build a simple sequential workflow using IN and OUT parameters. The sample is nearly identical to the Simple Sequential Workflow Sample sample, except the IN parameter is evaluated by the code condition in the IfElseActivity activity, and the order status is stored in an OUT parameter.

Communications Samples

Web Service Sample

Demonstrates how Web services can be invoked from the workflow and how a workflow can be published as a Web service.

Listen Sample

Introduces the ListenActivity activity, which is a composite activity that blocks and waits for one of n child branches to occur. Each child branch is a sequence with a blocking activity as a first step. Exactly one of the branches of a ListenActivityactivity will execute.

Correlated Local Service Sample

Demonstrates the use of correlation attributes with local services to raise correlated events to a workflow instance.

Simple Input Sample

Illustrates the use of queues to send data into a workflow.

Host Communication Sample

Demonstrates the communication with the workflow host application using a local service.

State Machine Communication Sample

Demonstrates how to move between states using HandleExternalEventActivity activities.

Custom Activities Samples

Simple Activity Sample

Illustrates how to add properties and handlers to a custom activity.

Basic Activity Designer Sample

Illustrates how to add a custom configuration error and a custom context menu to the designer associated with an activity.

Send E-mail Activity Sample

Illustrates the creation of a custom activity that can be used to send mail using the Simple Mail Transport Protocol (SMTP).

File System Watcher Activity Sample

Illustrates the creation of an activity that can be used to listen for file system events. It shows the use of queues in the development of an activity that listens for file system events, such as the creation of a file in a specific folder.

Designer Hosting Samples

Basic Designer Hosting Sample

Shows how the workflow designer can be re-hosted in a Windows application. The goal of this sample is to show how a separate development environment/execution environment can be created outside of Visual Studio.

Dynamic Update Samples

Dynamic Update from Workflow Sample

Demonstrates how to dynamically update a workflow instance when it is running from inside the workflow (code-beside).

Changing Rules Sample

Demonstrates how to dynamically change a rule condition from the host program.

Dynamic Update from Host Sample

Demonstrates how to dynamically update a workflow instance from outside the workflow, for example, the host program.

Hosting Samples

Custom Persistence Service Sample

Demonstrates the engine unloading a workflow by saving the workflow instance state through a custom persistence service, when the workflow waits during a Delay activity.

Raise Event to Load Workflow Sample

Demonstrates a document-approval scenario in which the workflow is unloaded from memory when it is idle and loaded back into memory upon event arrival.

Using Persistence Services Sample

Illustrates how to use the SqlWorkflowPersistenceService service, and how workflow instances are loaded and unloaded to and from memory by the application and the workflow runtime.

Canceling a Workflow Sample

Demonstrates how to exit a workflow that is waiting for an external event that will never occur.

Workflow Threading Sample

Shows the differences between running a workflow using the Manual Threading model and the default CLR threading model, and demonstrates the threading impact of using the DelayActivity activity in a workflow.

Persistence Host Sample

Shows how to reload a persisted workflow using a Windows Forms sample.

InMemory Samples

Simple In-Memory Sample

Shows how to load a workflow code file at run time.

Markup Samples

Sequential Markup Workflow Sample

Shows how to use a simple sequential workflow created as markup.

State Machine Markup Workflow Sample

Shows how to use a simple state machine workflow created as markup.

Workflow Serialization Sample

Shows how to serialize and reload a programmatically created workflow.

Custom Serialization Sample

Shows how to serialize advanced data types.

Roles Samples

Using Active Directory Roles Sample

Demonstrates the use of the ActiveDirectory roles in workflows.

Using Web Workflow Roles Sample

Demonstrates the use of the ASP roles in workflows.

Rules and Conditions Samples

IfElse with Rules Sample

Shows the use of a rule condition with an IfElseActivity activity.

Tracking Samples

Simple Tracking Sample

Illustrates the use of the SQL tracking service to track workflow events.

Query Using SQLTrackingService Sample

Illustrates the use of the SQL tracking service to track workflow events using a custom tracking profile.

Tracking Using User Track Points Sample

Illustrates the use of the SQL tracking service to track workflow events using user track points.

EventArgs Tracking Sample

Illustrates the use of the SQL tracking service to track workflow TrackingWorkflowTerminatedEventArgs, TrackingWorkflowSuspendedEventArgs, and TrackingWorkflowExceptionEventArgs.

ConsoleTrackingService Sample

Shows how to create a tracking service and write the contents of tracked data to the console.

RuleActionTrackingEvent Sample

Demonstrates how you can use tracking to determine rule actions in your workflow.

File Tracking Service and Query Sample

Illustrates how you can create a simple file-based tracking service that reads and writes TrackingProfile data to an XML file.

Using the Tracking Profile Object Model Sample

Shows how to create, serialize, and deserialize TrackingProfile data using the Tracking Profile Object Model.

SQL Data Maintenance Sample

Shows how to partition tracking data for ease in data archiving.

WorkflowCommitWorkBatch Service Samples

Using WorkflowCommitWorkBatch Service Sample

Illustrates how to create a custom service and have it participate in the same transaction as that of the workflow from which the service is invoked.

© 2007 Microsoft Corporation. All rights reserved.