private OcrSdkTask waitForTask(OcrSdkTask task)
{
Console.WriteLine(String.Format("Task status: {0}", task.Status));
while (task.IsTaskActive())
{
// Note: it's recommended that your application waits
// at least 2 seconds before making the first getTaskStatus request
// and also between such requests for the same task.
// Making requests more often will not improve your application performance.
// Note: if your application queues several files and waits for them
// it's recommended that you use listFinishedTasks instead (which is described
// at http://ocrsdk.com/documentation/apireference/listFinishedTasks/).
System.Threading.Thread.Sleep(5000);
task = restClient.GetTaskStatus(task.Id);
Console.WriteLine(String.Format("Task status: {0}", task.Status));
}
return task;
}