added samples
[windows-sources.git] / sdk / samples / WFSamples / Technologies / Communications / WebService / CS / WebServiceInvoke / Program.cs
blob656b02618cf61a811aba61aa898fc24384569798
1 //---------------------------------------------------------------------
2 // This file is part of the Windows Workflow Foundation SDK Code Samples.
3 //
4 // Copyright (C) Microsoft Corporation. All rights reserved.
5 //
6 //This source code is intended only as a supplement to Microsoft
7 //Development Tools and/or on-line documentation. See these other
8 //materials for detailed information regarding Microsoft code samples.
9 //
10 //THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
11 //KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
12 //IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
13 //PARTICULAR PURPOSE.
14 //---------------------------------------------------------------------
16 using System;
17 using System.Threading;
18 using System.Workflow.Runtime;
20 namespace Microsoft.Samples.Workflow.Communication.WebService
22 class Program
24 static AutoResetEvent waitHandle = new AutoResetEvent(false);
26 static void Main()
28 // Start the engine.
29 using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
31 workflowRuntime.StartRuntime();
33 workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
34 workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
36 // Load workflow type.
37 Type type = typeof(WebServiceInvokeWorkflow);
38 workflowRuntime.CreateWorkflow(type).Start();
40 waitHandle.WaitOne();
42 workflowRuntime.StopRuntime();
46 static void OnWorkflowCompleted(object sender, WorkflowCompletedEventArgs e)
48 waitHandle.Set();
51 static void OnWorkflowTerminated(object sender, WorkflowTerminatedEventArgs e)
53 Console.WriteLine(e.Exception.Message);
54 waitHandle.Set();