public bool PrintReport(PrinterJob printerJob) { return(SafeCall( () => _interactionChannel.PrintReport(printerJob), _printingCallProperties, false)); }
public void MoveDown(int id) { JobsDB jobsDB = GetTheJobsDB(); PrinterJob pj = jobsDB.Jobs.SingleOrDefault(j => j.Id == id); if (pj == null) { throw new ArgumentException("Can't find relevant printing job"); } else if (pj.Status == PrintJobStatusEnum.Printing.ToDescription()) { throw new ArgumentException("Can't move down the printing job"); } else if (pj.Order == jobsDB.Jobs.Count) { throw new ArgumentException("Can't move down, it's already the last printing job"); } else { PrinterJob bottomPG = jobsDB.Jobs.SingleOrDefault(j => j.Order == pj.Order + 1); if (bottomPG != null) { bottomPG.Order--; } pj.Order++; SetTheJobsDB(jobsDB); } }
public void CancelPrintingJob() { JobsDB jobsDB = GetTheJobsDB(); PrinterJob pj = jobsDB.Jobs.SingleOrDefault(j => j.Status == PrintJobStatusEnum.Printing.ToDescription()); if (pj == null) { throw new ArgumentException("Can't find relevant printing job"); } else { PrinterJob nextPG = jobsDB.Jobs.SingleOrDefault(j => j.Order == pj.Order + 1); if (nextPG != null) { nextPG.Status = PrintJobStatusEnum.Printing.ToDescription(); } jobsDB.Jobs.Where(j => j.Order > pj.Order).ToList().ForEach(j => j.Order--); pj.Status = PrintJobStatusEnum.Queued.ToDescription(); pj.Order = jobsDB.Jobs.Max(j => j.Order) + 1; SetTheJobsDB(jobsDB); } }
public PrinterJob GetCurrentPrintingJob() { JobsDB jobsDB = GetTheJobsDB(); PrinterJob pj = jobsDB.Jobs.SingleOrDefault(j => j.Status == PrintJobStatusEnum.Printing.ToDescription()); return(pj); }
public void HardwareWatchAuthenticationTest() { // Job Initalize hardware = new PrinterJob(); // Hardware Watch Authentication hardwareWatchAuthentication(); // Signal Setup hardware .Signal += Hardware_Signal; // Check Authentication if (hardware.Watcher.isAuthentication) { // Signal Start hardware .Watcher .Watch(); } else { Console.WriteLine("The authentication information is invalid."); } }
public void MoveUp(int id) { JobsDB jobsDB = GetTheJobsDB(); PrinterJob pj = jobsDB.Jobs.SingleOrDefault(j => j.Id == id); if (pj == null) { throw new ArgumentException("Can't find relevant printing job"); } else if (pj.Status == PrintJobStatusEnum.Printing.ToDescription()) { throw new ArgumentException("Can't move up the printing job"); } else if (pj.Order == 2) { throw new ArgumentException("Can't move up over the printing job"); } else { PrinterJob topPG = jobsDB.Jobs.SingleOrDefault(j => j.Order == pj.Order - 1); if (topPG != null) { topPG.Order++; } pj.Order--; SetTheJobsDB(jobsDB); } }
public NextActivityKey CheckGenerateNewReport (WorkflowExecutionContext context, ActivityParameterDictionary parameters) { if (_printerJob != null && (_printerJob.ReportType != ReportType || !NotGenerateNewReport)) { _printerJob = null; } return(context.DefaultNextActivityKey); }
public void Post(PrinterJob value) { // Add Item _ = db .PrintJobs .Add(value); // Save Item _ = db.SaveChangesAsync(); }
public void HardwareWatchTest() { // Job Initalize hardware = new PrinterJob(); // Signal Setup hardware .Signal += Hardware_Signal; // Signal Start hardware .Watcher .Watch(); }
public NextActivityKey CreateReport( WorkflowExecutionContext context, ActivityParameterDictionary parameters) { _scannerManager.SetIndicator("Подготовка печати..."); if (_printerJob == null) { _printerJob = _isPrinterRemote ? _syncManager.RemoteScanner.CreateReport(ReportType, ReportParameters, CopiesNumber) : _printingManager.CreateReport(ReportType, ReportParameters, CopiesNumber); } return(_printerJob == null ? BpcNextActivityKeys.No // если отчет так и не сформировался то ошибка : BpcNextActivityKeys.Yes); }
public async void PrintBoardingPass(object parameter) { if (this.SelectedReservation != null) { using (var print = new PrinterJob(Page, PrintJobType.BoardingPass, this.SelectedReservation)) { await Windows.Graphics.Printing.PrintManager.ShowPrintUIAsync(); } } else { var msg = new Windows.UI.Popups.MessageDialog(ResourceHelper.ResourceLoader.GetString("PrintReceiptMissingReservation")); await msg.ShowAsync(); } }
/// <summary> /// Initialize Hardware Managemnent Tools /// </summary> /// <see cref="https://azmisahin.github.io/azmisahin-software-hardware-tools-HMT-net-framework/"/> private void InitializeHMT() { // Job Initalize hardware = new PrinterJob(); // Hardware Watch Authentication hardwareWatchAuthentication(); // Signal Setup hardware .Signal += Hardware_Signal; // Signal Start hardware .Watcher .Watch(); }
public IActionResult NewJob(PrinterJob pj) { try { bool isItJobToPrintNow = _repository.AddNewJob(pj); if (isItJobToPrintNow) { _printerService.StartPrinting(); } } catch (Exception ex) { return(BadRequest(ex.Message)); } return(Ok()); }
public void RemovePrintedJob() { JobsDB jobsDB = GetTheJobsDB(); PrinterJob pj = jobsDB.Jobs.SingleOrDefault(j => j.Status == PrintJobStatusEnum.Printing.ToDescription()); if (pj != null) { PrinterJob nextPG = jobsDB.Jobs.SingleOrDefault(j => j.Order == pj.Order + 1); if (nextPG != null) { nextPG.Status = PrintJobStatusEnum.Printing.ToDescription(); } jobsDB.Jobs.Where(j => j.Order > pj.Order).ToList().ForEach(j => j.Order--); jobsDB.Jobs.Remove(pj); SetTheJobsDB(jobsDB); } }
public void DeleteById(int id) { JobsDB jobsDB = GetTheJobsDB(); PrinterJob pj = jobsDB.Jobs.SingleOrDefault(j => j.Id == id); if (pj == null) { throw new ArgumentException("Can't find relevant printing job"); } else if (pj.Status == PrintJobStatusEnum.Printing.ToDescription()) { throw new ArgumentException("Can't delete the printing job"); } else { jobsDB.Jobs.Where(j => j.Order > pj.Order).ToList().ForEach(j => j.Order--); jobsDB.Jobs.Remove(pj); SetTheJobsDB(jobsDB); } }
public bool AddNewJob(PrinterJob pj) { bool isItJobToPrintNow = false; if (string.IsNullOrWhiteSpace(pj.Name)) { throw new ArgumentException("Job name is empty"); } if (string.IsNullOrWhiteSpace(pj.Duration)) { throw new ArgumentException("Duration is corrupt or zero"); } JobsDB jobsDB = GetTheJobsDB(); pj.Id = jobsDB.NextId; jobsDB.NextId++; if (jobsDB.Jobs.Count == 0) { pj.Status = PrintJobStatusEnum.Printing.ToDescription(); pj.Order = 1; isItJobToPrintNow = true; } else { pj.Status = PrintJobStatusEnum.Queued.ToDescription(); pj.Order = jobsDB.Jobs.Max(j => j.Order) + 1; } jobsDB.Jobs.Add(pj); SetTheJobsDB(jobsDB); return(isItJobToPrintNow); }
public bool PrintReport(PrinterJob printerJob) { return(_localScannerChannel.PrintReport(printerJob)); }
bool IScannerInteractionChannel.PrintReport(PrinterJob printerJob) { return(_printingManager.PrintReport(printerJob)); }