Mega Code Archive

 
Categories / C# Tutorial / Workflow
 

Workflow Introduction

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();     }   } }