public static int TaskProgress(WebRequestSession session, String taskID, StringBuilder taskError) { string url = "/caxa/task_progress"; try { Boolean bSSL = session.ssl; String host = session.host; int port = session.port; String urlReq = String.Format("{0}?taskid={1}", url, taskID); int nProgress = -1; String taskStatus = ""; StringBuilder errMessage = new StringBuilder(); String txtResult = RemoteCall.RESTGetAsString(bSSL, host, port, urlReq, errMessage); if (txtResult != null) { JObject jResult = JObject.Parse(txtResult); if ((int)jResult["result_code"] > 0) { if (!String.IsNullOrEmpty("" + jResult["task_id"])) { if (!String.IsNullOrEmpty("" + jResult["task_progress"])) { nProgress = Convert.ToInt32(jResult["task_progress"]); } if (!String.IsNullOrEmpty("" + jResult["task_status"])) { taskStatus = Convert.ToString(jResult["task_status"]); if (taskError != null) { taskError.Append(taskStatus); } } } } else { if (errMessage.Length > 0) { if (taskError != null) { taskError.Append(errMessage); } } } } return(nProgress); } catch (Exception e) { Debug.WriteLine(e.Message); } return(-1); }