WF Program Instance Completion


When a WF program instance completes normally (the root activity moves to the Closed state of the activity automaton, and there is no unhandled exception), the WorkflowCompleted event is raised by WorkflowRuntime. In the handler of this event, the host is able to inspect the values of all gettable public properties of the root activity of the instance. This is shown in the following snippet, which uses the OutputParameters property of WorkflowCompletedEventArgs:

 using (WorkflowRuntime runtime = new WorkflowRuntime()) {   runtime.StartRuntime();   runtime.WorkflowCompleted += delegate(     object sender, WorkflowCompletedEventArgs e)   {     Dictionary<string, object> results =       e.OutputParameters;     foreach (string key in results.Keys)     {       object o = results[key];       ...     }   };  ... } 


As part of its completion, a WF program instance is unloaded if a persistence service is present.




Essential Windows Workflow Foundation
Essential Windows Workflow Foundation
ISBN: 0321399838
EAN: 2147483647
Year: 2006
Pages: 97

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net