/// <summary> /// Executes the task using the asynchronous ArcGIS Server geoprocessing task. /// </summary> /// <param name="parameters">A <see cref="T:System.Collections.Generic.List`1"/> of input /// <see cref="T:Geocrest.Model.ArcGIS.Tasks.GPParameter"/>s.</param> public void SubmitJobAsync(List <GPParameter> parameters) { if (this.UpdateDelay <= 0) { Throw.InvalidOperation("Update Delay must be greater than zero."); } JobParams jobParams = new JobParams(); jobParams.updateDelay = this.UpdateDelay; try { ValidateParameters(parameters); Uri endpoint; var paramDict = GetParameters(parameters); RestHelper.HydrateCompleted += RestHelper_SubmitJobComplete; if (TryParseUrl("submitJob", paramDict, out endpoint)) { RestHelper.HydrateAsync <JobInfo>(endpoint.ToString(), jobParams); } else { RestHelper.HydrateAsync <JobInfo>(endpoint.ToString(), GetParametersAsNVC(paramDict), "POST", jobParams); } } catch (Exception ex) { OnFailed(new TaskFailedEventArgs(ex)); } }
private void PrepareForPrinting(JobParams jobParams, FilamentSpool filament, FilamentProfile filamentProfile, bool bHomingRequired) { var stringList = new List <string> { string.Format("M106 S170"), string.Format("M109 S{0}", filament.filament_temperature), string.Format("M106 S255"), string.Format("M114"), string.Format("M117") }; if (bHomingRequired) { stringList.Add(string.Format("G91")); stringList.Add(string.Format("G0 Z2")); stringList.Add(string.Format("G28")); } else { stringList.Add(string.Format("G92 X{0} Y{1}", m_fLocationX, m_fLocationY)); stringList.Add(string.Format("M114")); } if (jobParams.options.use_heated_bed) { stringList.Add(string.Format("M190 S{0}", filamentProfile.preprocessor.initialPrint.BedTemperature)); } if (bHomingRequired) { stringList.Add(string.Format("G91")); stringList.Add(string.Format("G0 Z-2")); } stringList.Add(string.Format("G90")); var num = (int)m_oFirmwareController.WriteManualCommands(stringList.ToArray()); }
private RecentPrintsHistory.PrintHistory GatherData() { PrintJobDetails printJobDetails = printerview.CreatePrintJobDetails(out var modelZTooSmall); printJobDetails.GenerateSlicerSettings(null, printerview); var splitFileName = new SplitFileName(printJobDetails.objectDetailsList[0].filename); var printerJob = new JobParams("", splitFileName.name + "." + splitFileName.ext, printJobDetails.preview_image, FilamentSpool.TypeEnum.NoFilament, 0.0f, 0.0f) { options = printJobDetails.jobOptions, preprocessor = null, filament_temperature = 0, autoprint = printJobDetails.autoPrint }; List <Slicer.General.KeyValuePair <string, string> > keyValuePairList = slicer_connection.SlicerSettings.GenerateUserKeyValuePairList(); foreach (PrintDetails.ObjectDetails objectDetails in printJobDetails.objectDetailsList) { if (printJobDetails.autoPrint) { objectDetails.hidecontrols = true; } } RecentPrintsHistory.CreatePrintHistoryFolder(printerJob, null, slicer_connection.SlicerSettings.ProfileName, keyValuePairList, printJobDetails.objectDetailsList, out RecentPrintsHistory.PrintHistory cph); return(cph); }
public void consume() { if (check()) { int i = 10; bool needToExe = false; while (i > 0) { String valueStr = null; try { RedisValue value = db.SetPop(Const.Redis_Queue_Convert); if (!value.IsNullOrEmpty) { // 如果获取到转换队列中相关的任务,那么将消息队列中的转换任务加入到执行队列中 valueStr = value.ToString(); // 目前远程任务还不支持第二代压缩算法 RemoteConvertJob job = JsonConvert.DeserializeObject <RemoteConvertJob>(valueStr); JobParams jobParams = new JobParams(); jobParams.ignoreZeroIntensity = true; jobParams.log2 = false; jobParams.threadAccelerate = true; jobParams.suffix = ""; jobParams.creator = "LIMS Admin"; jobParams.mzPrecision = job.mzPrecision; string[] items = new string[4]; ListViewItem item = new ListViewItem(items); item.SubItems[0].Text = job.sourcePath; item.SubItems[1].Text = job.type; item.SubItems[2].Text = job.getAirdAlgorithmStr(); item.SubItems[3].Text = "Waiting"; item.SubItems[4].Text = job.targetPath; JobInfo jobInfo = new JobInfo(job.sourcePath, job.targetPath, job.type, jobParams, item); if (!ConvertTaskManager.getInstance().jobTable.Contains(jobInfo.jobId)) { Program.mainForm.lvFileList.Items.Add(item); ConvertTaskManager.getInstance().pushJob(jobInfo); needToExe = true; } } } catch (Exception e) { //出现异常的情况下需要将消息会退给Redis,方便下一次重试 if (valueStr != null) { db.SetAdd(Const.Redis_Queue_Convert, valueStr); } } i--; } //如果在Redis获取到了相关的转换任务 if (needToExe) { ConvertTaskManager.getInstance().run(); } } }
/// <summary> /// Create a new thread pool. number of threads in the pool can be smaller /// than maximum number of simultaneously placed job. Burst of new jobs can be /// served by small number of threads /// </summary> /// <param name="name"> /// A <see cref="System.String"/> /// Name of the thread pool as it appears in debug reports /// </param> /// <param name="threads"> /// A <see cref="System.Int32"/> /// Number of service threads /// </param> /// <param name="jobs"> /// A <see cref="System.Int32"/> /// Maximum number of pending (yet to be served) jobs. The maximum number of jobs /// can larger than number of service threads /// </param> /// <param name="priority"> /// A <see cref="Thread.Priority"/> /// Priority of the service threads /// </param> public ThreadPool(string name, int threads, int jobs, System.Threading.ThreadPriority priority) { this.Name = name; this.Threads = threads; this.Jobs = jobs; MinThreadsFree = threads; countStart = 0; countDone = 0; countMaxJobs = 0; countRunningThreads = 0; jobThreads = new Stack <JobThread>(threads); runningThreads = new List <JobThread>(threads); for (int i = 0; i < threads; i++) { JobThread jobThread = new JobThread(this, priority); jobThreads.Push(jobThread); } pendingJobs = new Queue <JobParams>(this.Jobs); freeJobs = new Stack <JobParams>(this.Jobs); for (int i = 0; i < this.Jobs; i++) { JobParams jobParams = new JobParams(); freeJobs.Push(jobParams); } // add myself to the list of created thread pools Resources.ThreadPools.Add(this); }
public static void CreatePrintHistoryFolder(JobParams printerJob, PrinterObject printer, string slicerProfileName, List <Slicer.General.KeyValuePair <string, string> > complete_slicer_settings, List <PrintDetails.ObjectDetails> original_objectList, out RecentPrintsHistory.PrintHistory cph) { cph = new RecentPrintsHistory.PrintHistory(printerJob.jobname, printerJob.jobGuid, DateTime.Now); cph.iconfilename = Path.Combine(cph.folder, "previewimage.jpg"); var printerViewFile = Path.Combine(cph.folder, "printerview.xml"); var printerSettingsFile = Path.Combine(cph.folder, "printersettings.xml"); try { Directory.CreateDirectory(cph.folder); var objectList = new List <PrintDetails.ObjectDetails>(); foreach (PrintDetails.ObjectDetails originalObject in original_objectList) { var filename = originalObject.filename; var objectDetails = new PrintDetails.ObjectDetails(originalObject) { printerSettingsXMLFile = "printersettings.xml", printerViewXMLFile = "printerview.xml", zipFileName = "", filename = Path.GetFileName(filename) }; objectList.Add(objectDetails); File.Copy(filename, Path.Combine(cph.folder, objectDetails.filename), true); } File.Copy(printerJob.preview_image_file_name, cph.iconfilename, true); SettingsManager.SavePrintingObjectsDetails(printerViewFile, objectList); SettingsManager.SavePrintJobInfo(printerSettingsFile, printerJob, printer, slicerProfileName, complete_slicer_settings); FileUtils.GrantAccess(cph.folder); } catch (Exception ex) { } }
public async Task <PagedList <JobDto> > GetJobsAsync(JobParams jobParams) { // get all the jobs first var query = _context.Jobs.AsQueryable(); // now filter it to the specific company being requested, if there is one. if (!string.IsNullOrEmpty(jobParams.Company)) { query = query.Where(c => c.Company.ToLower().IndexOf(jobParams.Company.ToLower()) != -1); } // now filter it to job titles containing the user filter if there is one. if (!string.IsNullOrEmpty(jobParams.Title)) { query = query.Where(t => t.Title.ToLower().IndexOf(jobParams.Title.ToLower()) != -1); } query = jobParams.OrderBy switch { "company" => query.OrderBy(u => u.Company), "title" => query.OrderBy(u => u.Title), _ => query.OrderBy(u => u.Created) }; return(await PagedList <JobDto> .CreateAsync ( query.ProjectTo <JobDto>(_mapper.ConfigurationProvider).AsNoTracking(), jobParams.PageNumber, jobParams.PageSize )); }
public void AddRecentPrintHistory(JobParams printerJob, PrinterObject printer, string slicerProfileName, List <Slicer.General.KeyValuePair <string, string> > complete_slicer_settings, List <PrintDetails.ObjectDetails> original_objectList) { RecentPrintsHistory.CreatePrintHistoryFolder(printerJob, printer, slicerProfileName, complete_slicer_settings, original_objectList, out PrintHistory cph); startedPrintList.Insert(0, cph); RefreshListChanged(); SaveStartedPrints(); }
public async Task <ActionResult <IEnumerable <JobDto> > > GetJobs([FromQuery] JobParams jobParams) { var jobs = await _jobRepository.GetJobsAsync(jobParams); Response.AddPaginationHeader(jobs.CurrentPage, jobs.PageSize, jobs.TotalCount, jobs.TotalPages); return(Ok(jobs)); }
/// <summary> /// return block jobParams to the pool of free blocks /// this method is called from the service thread /// </summary> protected void JobDone(JobParams jobParams) { lock (freeJobs) { jobParams.Init(); freeJobs.Push(jobParams); } }
public JobController.Result InitPrintJob(JobParams jobParams, string user, ulong ulFastForward = 0) { if (MyJobImplementation != null) { return(JobController.Result.FAILED_JobAlreadyStarted); } Processed = false; Printing = false; IsSavingToSD = false; ClearAllWarnings(); m_sGcodeFile = jobParams.gcodefile; Mode = jobParams.jobMode; PrinterInfo currentPrinterInfo = m_oParentFirmwareController.CurrentPrinterInfo; AbstractJob abstractJob; if (Mode == JobParams.Mode.SaveToBinaryGCodeFile) { abstractJob = new SaveGCodeToFileJob(jobParams, user, m_oParentFirmwareController.MyPrinterProfile); } else if (Mode != JobParams.Mode.FirmwarePrintingFromSDCard) { if (Mode == JobParams.Mode.SavingToSDCard || Mode == JobParams.Mode.SavingToSDCardAutoStartPrint) { m_sGcodeFile = GetFilenameForSDCard(jobParams.jobname, currentPrinterInfo.filament_info); } IsSimultaneousPrint = false; IsSavingToSD = Mode != JobParams.Mode.DirectPrinting; abstractJob = new SpoolerHostedJob(jobParams, user, m_oParentFirmwareController.MyPrinterProfile, IsSavingToSD && !IsSimultaneousPrint, ulFastForward); } else { if (Mode != JobParams.Mode.FirmwarePrintingFromSDCard) { throw new NotImplementedException("Software does not support printing from the SD card."); } abstractJob = new FirmwareSDPrintJob(jobParams, user, m_oParentFirmwareController.MyPrinterProfile); } m_oJobImplementation.Value = abstractJob; JobCreateResult jobCreateResult = abstractJob.Create(currentPrinterInfo); if (jobCreateResult.Result == ProcessReturn.SUCCESS) { m_olWarnings = jobCreateResult.Warnings; Processed = true; return(JobController.Result.Success); } m_oJobImplementation.Value = null; if (jobCreateResult.Result == ProcessReturn.FAILURE_OUT_OF_BOUNDS) { return(JobController.Result.FAILED_OutOfBounds); } return(jobCreateResult.Result == ProcessReturn.FAILURE_FILAMENT_MISMATCH ? JobController.Result.FAILED_IncompatibleFilament : JobController.Result.FAILED_Create); }
private CommandResult RecoverSDPrint(JobParams jobParams) { var num = (int)m_oFirmwareController.WriteManualCommands(new List <string>() { string.Format("M23 {0}", jobParams.gcodefile), string.Format("M26 S{0}", m_iPI_ProgressIndicator), string.Format("M24"), string.Format("M27") }.ToArray()); return(CommandResult.Success); }
public CommandResult RecoveryPrintFromPowerFailure(bool bHomingRequired) { if (m_oPrinterPowerRecovery.PrintingStatus == PowerRecovery.PowerResetState.NotPrinting) { return(CommandResult.Failed_Exception); } PrinterInfo currentPrinterInfo = m_oFirmwareController.CurrentPrinterInfo; if (currentPrinterInfo.persistantData.SavedJobInformation == null || currentPrinterInfo.persistantData.SavedJobInformation.Params == null) { return(CommandResult.Failed_RequiredDataNotAvailable); } JobParams jobParams = currentPrinterInfo.persistantData.SavedJobInformation.Params; FilamentSpool filament; if (jobParams.filament_temperature > 0 && jobParams.filament_type != FilamentSpool.TypeEnum.OtherOrUnknown && jobParams.filament_type != FilamentSpool.TypeEnum.NoFilament) { filament = new FilamentSpool(jobParams.filament_type, jobParams.filament_temperature); } else if (null != currentPrinterInfo.filament_info) { filament = new FilamentSpool(currentPrinterInfo.filament_info); } else { FilamentSpool.TypeEnum filamentTypeFromName = FirmwareSDPrintJob.GetFilamentTypeFromName(jobParams.gcodefile); switch (filamentTypeFromName) { case FilamentSpool.TypeEnum.NoFilament: case FilamentSpool.TypeEnum.OtherOrUnknown: return(CommandResult.Failed_RequiredDataNotAvailable); default: filament = new FilamentSpool(filamentTypeFromName, FilamentConstants.Temperature.Default(filamentTypeFromName)); break; } } var filamentProfile = FilamentProfile.CreateFilamentProfile(currentPrinterInfo.filament_info, m_oFirmwareController.MyPrinterProfile); PrepareForPrinting(jobParams, filament, filamentProfile, bHomingRequired || float.IsNaN(m_fLocationX) || float.IsNaN(m_fLocationY)); CommandResult commandResult = PowerRecovery.PowerResetState.PowerFailureSDPrint != m_oPrinterPowerRecovery.PrintingStatus ? RecoverSpooledPrint(currentPrinterInfo.persistantData.SavedJobInformation) : RecoverSDPrint(jobParams); if (commandResult == CommandResult.Success) { var num = (int)ClearPowerRecoveryFault(true); } else { m_oFirmwareController.SendEmergencyStop(); } return(commandResult); }
private void UpdateJobs(string result, string jobId) { if (!this.jobs.ContainsKey(jobId)) { return; } try { JobParams jobParams = this.jobs[jobId]; if (jobParams.cancelled) { this.jobs.Remove(jobId); jobParams.timer.Stop(); jobParams.timer = null; } else { ESRIException error = RestHelper.HydrateFromJson <ESRIException>(result); if (error != null && error.Error != null) { this.jobs.Remove(jobId); jobParams.timer.Stop(); jobParams.timer.Dispose(); jobParams.timer = null; OnFailed(new TaskFailedEventArgs(new HttpException((int)error.Error.Code, error.Error.Message))); return; } JobInfo jobInfo = RestHelper.HydrateFromJson <JobInfo>(result); JobCompletedEventArgs args = new JobCompletedEventArgs(jobInfo); switch (jobInfo.JobStatus) { case esriJobStatus.esriJobSucceeded: case esriJobStatus.esriJobFailed: case esriJobStatus.esriJobTimedOut: case esriJobStatus.esriJobCancelled: case esriJobStatus.esriJobDeleted: this.jobs.Remove(jobId); jobParams.timer.Stop(); jobParams.timer.Dispose(); jobParams.timer = null; this.OnJobCompleted(args); break; default: jobParams.timer.Start(); break; } } } catch (Exception ex) { OnFailed(new TaskFailedEventArgs(ex)); } }
public void injectPrintJob(FirmwareConnection connection, String gcodeFile) { JobParams jobParams = new JobParams(); Object printerJob = connection.GetType().Assembly.CreateInstance("Micro3DSpooler.Spooler_Server.PrinterJob", false, BindingFlags.CreateInstance, null, new object[] {jobParams, "user"}, null, null); Type printerJobType = printerJob.GetType(); var bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic; printerJob.GetType().GetField("gcodefilename", bindingFlags).SetValue(printerJob, gcodeFile); printerJob.GetType().InvokeMember("ProcessIncomingJob", BindingFlags.InvokeMethod | bindingFlags, null, printerJob, null); Object jobList = connection.GetType().GetField("jobslist", bindingFlags).GetValue(connection); jobList.GetType().InvokeMember("Add", BindingFlags.InvokeMethod, null, jobList, new object[]{ printerJob }); }
public M3DSettings(JobParams jobParams, PrinterObject printer, string profileName, List <Slicer.General.KeyValuePair <string, string> > curaSettings) { printSettings.filament = printer == null ? new PrintDetails.Filament(null) : new PrintDetails.Filament(printer.MyFilamentProfile); serialNumber = printer == null?PrinterSerialNumber.Undefined.ToString() : printer.Info.MySerialNumber; printSettings.options = jobParams.options; printSettings.CuraSettings = curaSettings; version = Version.VersionTextNoDate; this.profileName = profileName; jobGuid = ""; }
public void PrintModel(string sn, JobParams jobParams) { var printerBySerialNumber = (IPrinter)GetPrinterBySerialNumber(sn); if (printerBySerialNumber == null || !printerBySerialNumber.IsConnected()) { return; } var num = (int)printerBySerialNumber.PrintModel(null, null, jobParams); }
private void SaveGCodeToSDCard() { PrinterObject selectedPrinter1 = m_oSpoolerConnection.SelectedPrinter; if (selectedPrinter1 == null || !selectedPrinter1.IsConnected()) { return; } var sourceFileName = OpenModelFileDialog.RunOpenModelDialog(OpenModelFileDialog.FileType.GCode); if (string.IsNullOrEmpty(sourceFileName)) { return; } var str = Path.Combine(Paths.PublicDataFolder, "Working", "m3doutput.gcode"); if (sourceFileName != str) { try { File.Copy(sourceFileName, str, true); } catch (Exception ex) { m_oMessagebox.AddMessageToQueue("Unable to send gcode file. " + ex.Message); return; } } var UserJob = new JobParams(str, "User Job", "", selectedPrinter1.GetCurrentFilament().filament_type, 0.0f, 0.0f); UserJob.options.autostart_ignorewarnings = true; UserJob.options.turn_on_fan_before_print = true; UserJob.preprocessor = selectedPrinter1.MyFilamentProfile.preprocessor; UserJob.filament_temperature = selectedPrinter1.MyFilamentProfile.Temperature; UserJob.jobMode = JobParams.Mode.SavingToSDCard; PrinterObject selectedPrinter2 = m_oSpoolerConnection.SelectedPrinter; if (selectedPrinter2 == null || !selectedPrinter2.IsConnected()) { m_oMessagebox.AddMessageToQueue("Printer Disconnected", PopupMessageBox.MessageBoxButtons.OK); } else if (selectedPrinter2.PrinterState != PrinterObject.State.IsPrinting) { selectedPrinter2.AutoLockAndPrint(UserJob); } else { m_oMessagebox.AddMessageToQueue("Printer Busy", PopupMessageBox.MessageBoxButtons.OK); } }
public SpoolerResult PrintModel(AsyncCallback callback, object state, JobParams jobParams) { var spooler = (int)SendRPCToSpooler(callback, state, CallBackType.SuccessfullyReceived, false, "AddPrintJob", Environment.UserName, jobParams); if (spooler != 0) { return((SpoolerResult)spooler); } mylockID = Guid.Empty; lockstatus.Value = PrinterLockStatus.Unlocked; return((SpoolerResult)spooler); }
public void injectPrintJob(FirmwareConnection connection, String gcodeFile) { JobParams jobParams = new JobParams(); Object printerJob = connection.GetType().Assembly.CreateInstance("Micro3DSpooler.Spooler_Server.PrinterJob", false, BindingFlags.CreateInstance, null, new object[] { jobParams, "user" }, null, null); Type printerJobType = printerJob.GetType(); var bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic; printerJob.GetType().GetField("gcodefilename", bindingFlags).SetValue(printerJob, gcodeFile); printerJob.GetType().InvokeMember("ProcessIncomingJob", BindingFlags.InvokeMethod | bindingFlags, null, printerJob, null); Object jobList = connection.GetType().GetField("jobslist", bindingFlags).GetValue(connection); jobList.GetType().InvokeMember("Add", BindingFlags.InvokeMethod, null, jobList, new object[] { printerJob }); }
public SpoolerHostedJob(JobParams jobParams, string user, InternalPrinterProfile printerProfile, bool sdOnly, ulong ulFastForward) : base(jobParams, user, printerProfile) { aborted = false; m_bSDOnly = sdOnly; m_ulFastForward = ulFastForward; if (m_ulFastForward == 0UL) { return; } Details.jobParams.options.dont_use_preprocessors = true; Details.jobParams.options.dont_use_copy_to_spooler = true; }
/// <summary> /// Wait for start signal /// do the job, notify ThreadPool that the job is done /// </summary> public void Run() { while (true) { semaphore.WaitOne(); if (isStoped) { break; } // try to serve all pending jobs do { JobParams jobParams = default(JobParams); lock (threadPool.pendingJobs) { if (threadPool.pendingJobs.Count > 0) { jobParams = threadPool.pendingJobs.Dequeue(); } } if (jobParams != default(JobParams)) { threadPool.JobEnter(); // execute the job ServeJob(jobParams); // inform ThreadPool that the job is done threadPool.JobDone(jobParams); // let the tread pool know that i probably done checking the queue threadPool.JobExit(); } else // no more pending jobs in the queue { // get out no matter break; } }while (true); // inform ThreadPool that there is nothing to do threadPool.JobThreadDone(this); } semaphore.Close(); }
public void AddJobWithParams() { JobParams jobParams = new JobParams { Replicate = 1, Retry = 10, Ttl = 20, Maxlen = 10, Delay = 10, Async = true }; string jobId = q.AddJob(GetQueueName(), "message", 10, jobParams); jobId.Should().NotBeNullOrEmpty(); }
public void AddJobWithParams() { JobParams jobParams = new JobParams { Replicate = 1, Retry = 10, Ttl = 20, Maxlen = 10, Delay = 10, Async = true }; string jobId = q.AddJob(GetQueueName(), "message", 10, jobParams); jobId.Should().NotBeNullOrEmpty(); }
protected void ServeJob(JobParams jobParams) { IsRunning = true; object jobArgument = jobParams.jobArgument; // execute the job and notify the application // on execution jobParams.job(ref jobArgument); if (jobParams.jobDone != null) { jobParams.jobDone(jobArgument); } IsRunning = false; }
public void ConnectToRunningSDPrint(string user) { PrinterInfo currentPrinterInfo = m_oParentFirmwareController.CurrentPrinterInfo; JobParams jobParams = currentPrinterInfo.persistantData.SavedJobInformation == null ? new JobParams(null, "Print From SD", null, FilamentSpool.TypeEnum.OtherOrUnknown, 0.0f, 0.0f) : currentPrinterInfo.persistantData.SavedJobInformation.Params; ClearAllWarnings(); m_sGcodeFile = ""; Mode = JobParams.Mode.FirmwarePrintingFromSDCard; var firmwareSdPrintJob = new FirmwareSDPrintJob(jobParams, user, m_oParentFirmwareController.MyPrinterProfile); m_oJobImplementation.Value = firmwareSdPrintJob; firmwareSdPrintJob.ConnectToRunningSDPrint(); Processed = true; Printing = true; SaveJobState(); }
private void btnConvert_Click(object sender, EventArgs e) { if (tbFolderPath.Text == "") { MessageBox.Show("Output folder path is empty!"); return; } if (lvFileList.Items.Count == 0) { MessageBox.Show("No file is selected!"); return; } foreach (ListViewItem item in lvFileList.Items) { if (!ConvertTaskManager.getInstance().jobTable.ContainsKey(item.SubItems[0].Text)) { JobParams jobParams = new JobParams { ignoreZeroIntensity = cbIsZeroIntensityIgnore.Checked, log2 = cbLog2.Checked, threadAccelerate = cbThreadAccelerate.Checked, suffix = tbFileNameSuffix.Text, creator = tbOperator.Text, mzPrecision = Double.Parse(cbMzPrecision.Text), airdAlgorithm = cbAlgorithm.SelectedIndex + 1, // 1:ZDPD, 2:StackZDPD digit = (int)Math.Log(Int32.Parse(cbStackLayers.SelectedItem.ToString()), 2), includeCV = cbIncludingPSICV.Checked }; JobInfo jobInfo = new JobInfo(item.SubItems[0].Text, tbFolderPath.Text, item.SubItems[1].Text, jobParams, item); ConvertTaskManager.getInstance().pushJob(jobInfo); } } try { ConvertTaskManager.getInstance().run(); } catch (Exception exception) { MessageBox.Show(exception.ToString()); } }
public async Task <PagedList <Job> > GetJobsAvailablePagination(JobParams jobParams) { var query = _context.Jobs .AsQueryable(); query = query.Where(u => u.Salary >= jobParams.MinSalary && u.Salary <= jobParams.MaxSalary); query = query.Where(u => u.IsAvailable == true); if (!string.IsNullOrEmpty(jobParams.Search)) { query = query.Where(e => e.JobName.ToLower().Contains(jobParams.Search)); } return(await PagedList <Job> .CreateAsync(query.AsNoTracking(), jobParams.PageNumber, jobParams.PageSize)); }
private void RestHelper_SubmitJobComplete(object sender, HydrateCompletedEventArgs args) { try { RestHelper.HydrateCompleted -= RestHelper_SubmitJobComplete; JobInfo info = args.Result as JobInfo; if (args.HasError) { OnFailed(new TaskFailedEventArgs(args.Error)); } else if (info != null) { JobParams jp = args.UserState as JobParams; this.jobs[info.JobId] = jp; jp.timer = new Timer((double)this.UpdateDelay); jp.timer.Elapsed += (s, e) => { jp.timer.Stop(); if (!jp.cancelled) { Dictionary <string, string> temp_91 = new Dictionary <string, string>(); if (jp.webClient == null) { jp.webClient = this.RestHelper.WebHelper.GetWebHelper(); } string result = jp.webClient.DownloadString(GetUrl(string.Format("jobs/{0}", info.JobId))); this.UpdateJobs(result, info.JobId); } else { this.jobs.Remove(info.JobId); } }; jp.timer.Start(); } else { OnFailed(new TaskFailedEventArgs(new HttpException((int)HttpStatusCode.NoContent, string.Format("The response from '{0}' was empty.", this.Url)))); } } catch (Exception ex) { OnFailed(new TaskFailedEventArgs(ex)); } }
public AbstractJob(JobParams jobParams, string user, InternalPrinterProfile printerProfile) { MyPrinterProfile = printerProfile; Status = JobStatus.Queued; PreviewImageFileName = "null"; jobDetails = new JobDetails(); Details.jobParams = jobParams; Details.bounds = new BoundingBox(float.MaxValue, float.MaxValue, float.MaxValue, float.MinValue, float.MinValue, float.MinValue); Details.ideal_temperature = 0; User = user; job_begin_timer = new Stopwatch(); InitialSpoolUsed = new FilamentSpool { filament_temperature = jobParams.filament_temperature, filament_type = jobParams.filament_type }; }
public void Update() { AbstractJob jobImplementation = MyJobImplementation; PrinterInfo currentPrinterInfo = m_oParentFirmwareController.CurrentPrinterInfo; if (jobImplementation == null) { return; } jobImplementation.Update(currentPrinterInfo); if (!jobImplementation.Done || !SwitchToFirmwarePrintWhenDone) { return; } m_lsAdditionalTimeRemaining = 0.0f; var jobParams = new JobParams(jobImplementation.Details.jobParams) { preview_image_file_name = jobImplementation.PreviewImageFileName, jobMode = JobParams.Mode.FirmwarePrintingFromSDCard }; Mode = JobParams.Mode.FirmwarePrintingFromSDCard; jobParams.gcodefile = m_sGcodeFile; var abstractJob = (AbstractJob) new FirmwareSDPrintJob(jobParams, User, jobImplementation.MyPrinterProfile); abstractJob.Create(currentPrinterInfo); FinalizeEndOfJob(out List <string> end_gcode); if (end_gcode != null && end_gcode.Count > 0) { var num1 = (int)m_oParentFirmwareController.WriteManualCommands(end_gcode.ToArray()); } IsSimultaneousPrint = false; IsSavingToSD = false; m_oJobImplementation.Value = abstractJob; var num2 = (int)Start(out List <string> start_gcode); if (start_gcode == null || start_gcode.Count <= 0) { return; } var num3 = (int)m_oParentFirmwareController.WriteManualCommands(start_gcode.ToArray()); }
public static bool SavePrintJobInfo(string printerSettingsFile, JobParams jobParams, PrinterObject printer, string slicerProfileName, List <Slicer.General.KeyValuePair <string, string> > userKeyValuePairList) { var m3Dsettings = new PrintDetails.M3DSettings(jobParams, printer, slicerProfileName, userKeyValuePairList); try { var textWriter = (TextWriter) new StreamWriter(printerSettingsFile); var namespaces = new XmlSerializerNamespaces(); namespaces.Add(string.Empty, string.Empty); PrintDetails.M3DSettings.ClassSerializer.Serialize(textWriter, m3Dsettings, namespaces); textWriter.Close(); } catch (Exception ex) { return(false); } return(true); }