1 // Copyright (c) Microsoft Corporation. All rights reserved.
4 using System
.ServiceModel
;
5 using System
.ServiceModel
.Description
;
6 using System
.Workflow
.Runtime
;
7 using System
.Workflow
.Runtime
.Hosting
;
9 namespace Microsoft
.WorkflowServices
.Samples
13 static void Main(string[] args
)
15 WorkflowServiceHost host
= new WorkflowServiceHost(typeof(CustomerWorkflow
));
17 host
.Description
.Behaviors
.Find
<WorkflowRuntimeBehavior
>().WorkflowRuntime
.WorkflowTerminated
+= delegate(object sender
, WorkflowTerminatedEventArgs e
) { Console.WriteLine("WorkflowTerminated: " + e.Exception.Message); }
;
18 host
.Description
.Behaviors
.Find
<WorkflowRuntimeBehavior
>().WorkflowRuntime
.WorkflowCompleted
+= delegate(object sender
, WorkflowCompletedEventArgs e
) { Console.WriteLine("WorkflowCompleted."); }
;
21 Console
.WriteLine("Role: Customer");
22 Console
.WriteLine("Press <enter> to submit order.");
25 WorkflowInstance workflow
= host
.Description
.Behaviors
.Find
<WorkflowRuntimeBehavior
>().WorkflowRuntime
.CreateWorkflow(typeof(CustomerWorkflow
));
28 Console
.ForegroundColor
= ConsoleColor
.Red
;
29 Console
.WriteLine("Press <enter> to exit");