1 // ****************************************************************************
2 // Copyright (C) Microsoft Corporation. All rights reserved.
7 using System.Threading;
8 using System.Diagnostics;
9 using System.Globalization;
10 using System.Collections;
11 using System.Collections.Generic;
12 using System.Collections.ObjectModel;
14 using System.Workflow.Runtime;
15 using System.Workflow.ComponentModel;
16 using System.Workflow.Runtime.Hosting;
18 namespace System.Workflow.Runtime
21 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
22 public class WorkflowEventArgs : EventArgs
24 private WorkflowInstance _instance;
26 internal WorkflowEventArgs(WorkflowInstance instance)
31 public WorkflowInstance WorkflowInstance
40 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
41 public class WorkflowCompletedEventArgs : WorkflowEventArgs
43 private Dictionary<String, Object> _outputParameters;
44 private Activity _originalWorkflowDefinition;
45 private Activity _workflowDefinition;
47 internal WorkflowCompletedEventArgs(WorkflowInstance instance, Activity workflowDefinition)
50 this._outputParameters = new Dictionary<String, Object>();
51 this._originalWorkflowDefinition = workflowDefinition;
52 this._workflowDefinition = null;
55 public Dictionary<String, Object> OutputParameters
59 return this._outputParameters;
63 public Activity WorkflowDefinition
67 if (this._workflowDefinition == null)
69 using (new WorkflowDefinitionLock(this._originalWorkflowDefinition))
71 if (this._workflowDefinition == null)
73 // Clone the original definition after locking the
74 // definition's sync object which was passed in
75 // the constructor. This is so that the host cannot
76 // corrupt the shared definition
77 Activity tempDefinition = this._originalWorkflowDefinition.Clone();
78 Thread.MemoryBarrier();
79 this._workflowDefinition = tempDefinition;
84 return this._workflowDefinition;
89 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
90 public class WorkflowSuspendedEventArgs : WorkflowEventArgs
92 private String _error;
94 internal WorkflowSuspendedEventArgs(WorkflowInstance instance, String error)
109 [Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
110 public class WorkflowTerminatedEventArgs : WorkflowEventArgs
112 private Exception exception;
114 internal WorkflowTerminatedEventArgs(WorkflowInstance instance, String error)
117 this.exception = new WorkflowTerminatedException(error);
119 internal WorkflowTerminatedEventArgs(WorkflowInstance instance, Exception e)
125 public Exception Exception
129 return this.exception;
134 internal sealed class WorkflowDefinitionEventArgs : EventArgs
136 private Type _workflowType;
137 private byte[] _xomlHashCode;
139 internal WorkflowDefinitionEventArgs(Type scheduleType)
141 _workflowType = scheduleType;
144 internal WorkflowDefinitionEventArgs(byte[] scheduleDefHash)
146 _xomlHashCode = scheduleDefHash;
149 public Type WorkflowType
153 return _workflowType;
157 public byte[] WorkflowDefinitionHashCode
161 return _xomlHashCode;