Workflow Created:
This event occurs when a workflow instance has been created.The workflow runtime engine raises the WorkflowCreated event after the workflow instance has been completely constructed but before activities are processed.
workflowRuntime.WorkflowCreated += delegate(object sender, WorkflowEventArgs e)
{
waitHandle.Set();
Console.WriteLine("Workflow Created");
};
Workflow Started:
This event occurs when a workflow instance has been started.
workflowRuntime.WorkflowStarted += delegate(object sender, WorkflowEventArgs e)
{
Console.WriteLine("Workflow Started");
waitHandle.Set();
};
Workflow Loaded:
This event occurs when the workflow instance is loaded into the memory.WorkflowLoaded occurs after the persistence service has restored the workflow instance, but before the workflow runtime engine begins to execute any activities.
workflowRuntime.WorkflowLoaded += delegate(object sender, WorkflowEventArgs e)
{
Console.WriteLine("Workflow Loaded");
waitHandle.Set();
};
Workflow Idled:
This event occures when the workflow instance enters the idle state. For eg when the workflow instance is waiting for the delay activity.
workflowRuntime.WorkflowIdled += delegate(object sender, WorkflowEventArgs e)
{
Console.WriteLine("Workflow Idled");
waitHandle.Set();
};
Workflow Suspended:
This event occurs when a workflow instance is suspended.The workflow instance can be suspended by the host through a call to the Suspend method, by a SuspendActivity activity, or implicitly by the workflow runtime engine. For example, the workflow runtime engine temporarily suspends the instance when it applies dynamic changes to the instance.
workflowRuntime.WorkflowSuspended += delegate(object sender, WorkflowSuspendedEventArgs e)
{
Console.WriteLine("Workflow Suspended");
waitHandle.Set();
e.WorkflowInstance.Resume();
};
Workflow Resumed:
This event occurs when the workflow when the execution of a instance is resumed followed by the suspension.The WorkflowResumed event is usually raised because of an explicit call to WorkflowInstance.Resume.
workflowRuntime.WorkflowResumed += delegate(object sender, WorkflowEventArgs e)
{
Console.WriteLine("Workflow Resumed");
waitHandle.Set();
};
Workflow Completed:
This event occurs when a workflow instance has completed.
workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e)
{
Console.WriteLine("Workflow Completed");
waitHandle.Set();
};
Workflow Aborted:
This event occurs when a workflow instance is aborted. This will aborted only after all pending work for the workflow instance has been cleared but before the workflow instance is invalidated in memory.
instance.abort();
We can call the workflowaborted event when the workflow gets cancelled due to some reasons.
workflowRuntime.WorkflowAborted += delegate(object sender, WorkflowEventArgs e)
{
Console.WriteLine("Workflow Aborted");
waitHandle.Set();
};
Workflow Terminated:
This event occurs when a workflow instance is terminated.The workflow can be terminated by the host through a call to the Terminate method, by a TerminateActivity activity, or by the workflow runtime engine when an unhandled exception occurs. The workflow runtime engine raises the WorkflowTerminated event after the workflow instance has been terminated.
workflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e)
{
Console.WriteLine("Workflow Terminated");
waitHandle.Set();
};
Workflow Unloaded:
This occurs when the workflow instance is unloaded from the memory.A workflow instance may be unloaded from memory by an explicit call to Unload, or implicitly by the workflow runtime engine according to its own semantics.
workflowRuntime.WorkflowUnloaded += delegate(object sender, WorkflowEventArgs e)
{
Console.WriteLine("Workflow Unloaded");
waitHandle.Set();
};