Exemplo n.º 1
0
        /// <summary>
        /// Creates a progress report object indicating failure, with the specified message.
        /// Other fields are null.
        /// </summary>
        /// <param name="message">Message to report</param>
        /// <returns>New JobProgress object</returns>
        public static JobProgress CreateFailResponse(string message)
        {
            JobProgress progress = new JobProgress();

            progress.res     = false;
            progress.message = message;

            return(progress);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a Progress report object from a given StoredJob object
        /// </summary>
        /// <param name="job">Job to report on</param>
        /// <returns>New JobProgress object</returns>
        public static JobProgress CreateFromStored(StoredJob job)
        {
            JobProgress progress = new JobProgress();

            progress.JobId = job.JobId;

            progress.Completed = job.Completed;
            progress.Started   = job.Started;
            progress.Paused    = job.Paused;

            if (job.Completed)
            {
                progress.Progress = 1;
            }
            else
            {
                progress.Progress = (float)job.BatchIndex / (float)job.Images.Length;
            }

            progress.res = true;

            return(progress);
        }