Beispiel #1
0
 public OcrSdkTask()
 {
     Status = TaskStatus.Unknown;
     Id     = new TaskId("<unknown>");
 }
Beispiel #2
0
 public OcrSdkTask(TaskId id, TaskStatus status)
 {
     Id     = id;
     Status = status;
 }
Beispiel #3
0
        /// <summary>
        /// Get task data from xml node "task"
        /// </summary>
        private static OcrSdkTask getTaskInfo(XElement xTask)
        {
            TaskId     id     = new TaskId(xTask.Attribute("id").Value);
            TaskStatus status = statusFromString(xTask.Attribute("status").Value);

            OcrSdkTask task = new OcrSdkTask();

            task.Id     = id;
            task.Status = status;

            XAttribute xRegistrationTime = xTask.Attribute("registrationTime");

            if (xRegistrationTime != null)
            {
                DateTime time;
                if (DateTime.TryParse(xRegistrationTime.Value, out time))
                {
                    task.RegistrationTime = time;
                }
            }

            XAttribute xStatusChangeTime = xTask.Attribute("statusChangeTime");

            if (xStatusChangeTime != null)
            {
                DateTime time;
                if (DateTime.TryParse(xStatusChangeTime.Value, out time))
                {
                    task.StatusChangeTime = time;
                }
            }

            XAttribute xFilesCount = xTask.Attribute("filesCount");

            if (xFilesCount != null)
            {
                int filesCount;
                if (Int32.TryParse(xFilesCount.Value, out filesCount))
                {
                    task.FilesCount = filesCount;
                }
            }

            XAttribute xCredits = xTask.Attribute("credits");

            if (xCredits != null)
            {
                int credits;
                if (Int32.TryParse(xCredits.Value, out credits))
                {
                    task.Credits = credits;
                }
            }

            XAttribute xDescription = xTask.Attribute("description");

            if (xDescription != null)
            {
                task.Description = xDescription.Value;
            }

            XAttribute xResultUrl = xTask.Attribute("resultUrl");

            if (xResultUrl != null)
            {
                task.DownloadUrl = xResultUrl.Value;
            }

            return(task);
        }