public virtual ProcessingJob imageReady(IImage16 img)
        {
            global::System.IntPtr cPtr = libPhotoAssistantImageProcessingPINVOKE.BatchProcessingListener_imageReady(swigCPtr, IImage16.getCPtr(img));
            ProcessingJob         ret  = (cPtr == global::System.IntPtr.Zero) ? null : new ProcessingJob(cPtr, false);

            return(ret);
        }
        public static IImage16 processImage(ProcessingJob job, SWIGTYPE_p_int errorCode)
        {
            global::System.IntPtr cPtr = libPhotoAssistantImageProcessingPINVOKE.processImage__SWIG_3(ProcessingJob.getCPtr(job), SWIGTYPE_p_int.getCPtr(errorCode));
            IImage16 ret = (cPtr == global::System.IntPtr.Zero) ? null : new IImage16(cPtr, false);

            if (libPhotoAssistantImageProcessingPINVOKE.SWIGPendingException.Pending)
            {
                throw libPhotoAssistantImageProcessingPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #3
0
        public static ProcessingJob create(InitialImage initialImage, ProcParams pparams)
        {
            global::System.IntPtr cPtr = libPhotoAssistantImageProcessingPINVOKE.ProcessingJob_create__SWIG_1(InitialImage.getCPtr(initialImage), ProcParams.getCPtr(pparams));
            ProcessingJob         ret  = (cPtr == global::System.IntPtr.Zero) ? null : new ProcessingJob(cPtr, false);

            if (libPhotoAssistantImageProcessingPINVOKE.SWIGPendingException.Pending)
            {
                throw libPhotoAssistantImageProcessingPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
        public static IImage16 processImage(ProcessingJob job, SWIGTYPE_p_int errorCode, ProgressListener pl, bool tunnelMetaData, bool flush)
        {
            global::System.IntPtr cPtr = libPhotoAssistantImageProcessingPINVOKE.processImage__SWIG_0(ProcessingJob.getCPtr(job), SWIGTYPE_p_int.getCPtr(errorCode), ProgressListener.getCPtr(pl), tunnelMetaData, flush);
            IImage16 ret = (cPtr == global::System.IntPtr.Zero) ? null : new IImage16(cPtr, false);

            if (libPhotoAssistantImageProcessingPINVOKE.SWIGPendingException.Pending)
            {
                throw libPhotoAssistantImageProcessingPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
        public async Task PersistImage(string imageId, Guid userId, string sourceId, string message, int resolution)
        {
            var handler = new MongoDbFileHandler(_mongoConnectionString);
            var image   = await handler.GetMessageObject <DtoImage>(imageId);

            var store = DocumentStore.For(_dbConnectionString);

            using (var session = store.LightweightSession())
            {
                var user = await session.Query <User>().Where(x => x.Id == userId).FirstAsync();

                var processingJob = await session.Query <ProcessingJob>().Where(x => x.UserId == user.Id && x.SourceId == sourceId).FirstOrDefaultAsync();

                if (processingJob == null)
                {
                    processingJob = new ProcessingJob
                    {
                        Timestamp = DateTime.Now,
                        Message   = message,
                        UserId    = user.Id,
                        SourceId  = sourceId,
                        Images    = new List <Image>(),
                        Filename  = image.FileName
                    };
                }
                var dbImage = new Image
                {
                    Data       = image.Data,
                    Id         = Guid.NewGuid(),
                    Resolution = resolution
                };
                processingJob.Images.Add(dbImage);
                session.Store(processingJob);
                session.SaveChanges();
            }
        }
 public static void startBatchProcessing(ProcessingJob job, BatchProcessingListener bpl, bool tunnelMetaData)
 {
     libPhotoAssistantImageProcessingPINVOKE.startBatchProcessing(ProcessingJob.getCPtr(job), BatchProcessingListener.getCPtr(bpl), tunnelMetaData);
 }
 public void UpdateJob(ProcessingJob job)
 {
     _repository.UpdateJob(job);
 }
 public bool AddJob(ProcessingJob newJob)
 {
     _repository.AddJob(newJob);
     return _repository.SaveAll();
 }
Пример #9
0
 public static void destroy(ProcessingJob job)
 {
     libPhotoAssistantImageProcessingPINVOKE.ProcessingJob_destroy(ProcessingJob.getCPtr(job));
 }
Пример #10
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ProcessingJob obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
        public JsonResult Post([FromBody]ProcessingJobSubmitViewModel vm)
        {
            _logger.LogInformation("Creating job");
            if (vm != null)
            {

                try
                {
                    if (ModelState.IsValid)
                    {
                        var newJob = new ProcessingJob
                        {
                            Id = Guid.NewGuid(),
                            Name = vm.Name,
                            Status = "NotDone"
                        };

                        var work = vm.Work.Select(x => new ProcessingJobWork
                        {
                            ClientId = Guid.Empty,
                            EndIndex = x.EndIndex,
                            Goal = x.Goal,
                            JobId = newJob.Id,
                            List1 = x.List1,
                            List2 = x.List2,
                            StartIndex = x.StartIndex,
                            Status = "NotStarted",
                            WorkId = x.WorkId
                        });

                        if (_service.AddJob(newJob))
                        {
                            if (_service.AddJobWork(work))
                            {
                                var retVm = new ProcessingJobViewModel
                                {
                                    Id = newJob.Id,
                                    Name = newJob.Name,
                                    Ref = $"/api/processingjob/{newJob.Id}",
                                    Status = newJob.Status,
                                    WorkUrl = $"/api/processingjob/{newJob.Id}/work/"
                                };
                                Response.StatusCode = (int)HttpStatusCode.Created;
                                return Json(retVm);
                            }
                            else
                            {
                                //_service.RemoveJob(newJob);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Response.StatusCode = (int)HttpStatusCode.BadRequest;
                    return Json(new { Message = ex.Message });
                }
            }

            Response.StatusCode = (int)HttpStatusCode.BadRequest;
            return Json(new { Message = "Failed", ModelState = ModelState });
        }