added SSCLI 1.0
[windows-sources.git] / sdk / samples / WCFSamples / TechnologySamples / Scenario / WorkflowServices / Conversations / CS / Customer / Program.cs
blob62889f82785f29d7c11493cdfd94b7177319a3b0
1 // Copyright (c) Microsoft Corporation. All rights reserved.
3 using System;
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
11 class Program
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."); };
19 host.Open();
21 Console.WriteLine("Role: Customer");
22 Console.WriteLine("Press <enter> to submit order.");
23 Console.ReadLine();
25 WorkflowInstance workflow = host.Description.Behaviors.Find<WorkflowRuntimeBehavior>().WorkflowRuntime.CreateWorkflow(typeof(CustomerWorkflow));
26 workflow.Start();
28 Console.ForegroundColor = ConsoleColor.Red;
29 Console.WriteLine("Press <enter> to exit");
30 Console.ResetColor();
31 Console.ReadLine();
32 host.Close();