When using DataWatch API, the GetStatus() method does not give correct status
I used the DataWatch API to call the DataWatch process from a .NET program. I could call the correct process but I could not get the correct status from after the process is called. I think it's because the GetStatus method does not wait for the StartProcess() method to finish.
I used the following code, I had to use Thread.Sleep to pause to get the status but then it is not reliable. Is there any other way to get the correct status? I need to pass the status to the calling program to show whether the call is a success or failure.
Thanks for you help!
if (m_bLocal)
strTrackingID = PumpAPI.StartProcess(processName);
else
{
strTrackingID = WebService.StartProcess(processName);
System.Threading.Thread.Sleep(2000);
int response = WebService.GetStatus(strTrackingID);
switch (response)
{
case 2:
jobStatus = true;
break;
case 3:
jobStatus = false;
break;
default:
jobStatus = false;
break;
}
}