Workflow Introduction : Introduction « Workflow « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Text;

using System.Workflow.Runtime;
using System.Workflow.Activities;

namespace WorkflowIntroduction
{
  public class SimpleWorkflow : SequentialWorkflowActivity
  {
    public SimpleWorkflow()
    {
      CodeActivity ca = new CodeActivity();

      ca.ExecuteCode += delegate
      {
        Console.WriteLine("activity executed");
        Console.WriteLine("Press <enter> to stop the workflow");
        Console.ReadLine();
      };

      this.Activities.Add(ca);
    }
  }

  class Program
  {
    static void Main(string[] args)
    {
      WorkflowRuntime runtime = new WorkflowRuntime();

      runtime.StartRuntime();

      WorkflowInstance instance = runtime.CreateWorkflow(typeof(SimpleWorkflow));

      instance.Start();

      runtime.StopRuntime();

    }
  }
}








26.1.Introduction
26.1.1.Workflow Introduction