static void Main() { orderService = new OrderServiceImpl(); // Start the workflow runtime engine. using (WorkflowRuntime workflowRuntime = new WorkflowRuntime()) { ExternalDataExchangeService dataService = new ExternalDataExchangeService(); workflowRuntime.AddService(dataService); dataService.AddService(orderService); workflowRuntime.StartRuntime(); // Listen for the workflow events workflowRuntime.WorkflowCompleted += OnWorkflowCompleted; workflowRuntime.WorkflowTerminated += OnWorkflowTerminated; workflowRuntime.WorkflowIdled += OnWorkflowIdled; // Start the workflow and wait for it to complete Type type = typeof(PurchaseOrderWorkflow); workflowRuntime.CreateWorkflow(type).Start(); waitHandle.WaitOne(); // Stop the workflow runtime engine. workflowRuntime.StopRuntime(); } }