1 #region Using directives
4 using System
.Collections
.Generic
;
6 using System
.Threading
;
7 using System
.Workflow
.Runtime
;
8 using System
.Workflow
.Runtime
.Hosting
;
9 using Microsoft
.ServiceModel
.Samples
.Properties
;
13 namespace Microsoft
.ServiceModel
.Samples
17 static AutoResetEvent waitHandle
= new AutoResetEvent(false);
19 static void Main(string[] args
)
21 string input
= "Hello world";
22 Console
.WriteLine("Input parameter for this workflow is {0}", input
);
23 Dictionary
<string, object> parameters
= new Dictionary
<string, object>();
24 parameters
.Add("Input", input
);
26 WorkflowRuntime workflowRuntime
= new WorkflowRuntime();
28 workflowRuntime
.WorkflowCompleted
+= new EventHandler
<WorkflowCompletedEventArgs
>(workflowRuntime_WorkflowCompleted
);
29 workflowRuntime
.WorkflowTerminated
+= new EventHandler
<WorkflowTerminatedEventArgs
>(workflowRuntime_WorkflowTerminated
);
31 WorkflowInstance instance
= workflowRuntime
.CreateWorkflow(typeof(Workflow1
), parameters
);
32 Console
.WriteLine("Starting workflow");
37 Console
.WriteLine("Press <ENTER> to terminate program.");
41 static void workflowRuntime_WorkflowTerminated(object sender
, WorkflowTerminatedEventArgs e
)
43 Console
.WriteLine(e
.Exception
.Message
);
48 static void workflowRuntime_WorkflowCompleted(object sender
, WorkflowCompletedEventArgs e
)
50 Console
.WriteLine("Workflow completed");
51 string returnValue
= (string)e
.OutputParameters
["ReturnValue"];
52 Console
.WriteLine("The ReturnValue for this workflow was {0}", returnValue
);