Datasheet

Chapter 1: Work ow Programming Principles
32
Listing 1 - 11 follows the best practice of instantiating SPSite and SPWeb objects in the context of using
statements to ensure that the Dispose methods of these objects are automatically invoked when they go
out of scope.
Next, we ll design a workflow that uses the custom activities and condition that we ve developed in this
chapter, as shown in Listing 1 - 12 .
Listing 1 - 12: A workflow that uses the custom activities and condition developed in
this chapter
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Workflow;
using Microsoft.SharePoint.WorkflowActions;
using Microsoft.Office.Workflow.Utility;
namespace Chapter1
{
public sealed class Workflow1 : SequentialWorkflowActivity
{
private LogToHistoryListActivity logToHistoryListActivity2;
private LogToHistoryListActivity logToHistoryListActivity3;
private OnWorkflowActivated onWorkflowActivated1;
private WhileActivity whileActivity1;
private LogToHistoryListActivity logToHistoryListActivity1;
private LogToHistoryListActivity logToHistoryListActivity4;
private SequenceActivity sequenceActivity1;
private SequenceActivity sequenceActivity2;
public Workflow1()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.CanModifyActivities = true;
Chapter1.CustomCondition customcondition1 =
new Chapter1.CustomCondition();
c01.indd 32c01.indd 32 8/25/08 4:03:00 PM8/25/08 4:03:00 PM