/// <summary> /// Start a new print job /// </summary> private void StartPrintJob() { if (image == null) { return; } if (!SetupPrinter()) { MessageBox.Show("Failed to setup printer"); return; } PreLoadPrintJob test = new PreLoadPrintJob(UserBitsPerPixel, image, UserYTop, UserCopies, UserRepeatMode, jobid++); // Move status to LOADING if Meteor has hardware connected - refresh the display // immediately because sending the print data to Meteor in PreLoadPrintJob.Start // can take a significant amount of time for a large image if (latestPrinterStatus == PRINTER_STATUS.IDLE) { textBoxStatus.Text = PRINTER_STATUS.LOADING.ToString(); bJobStarting = true; textBoxStatus.Refresh(); } Cursor.Current = Cursors.WaitCursor; eRET rVal = test.Start(); Cursor.Current = Cursors.Default; if (rVal != eRET.RVAL_OK) { string Err = string.Format("Failed to start print job\n\n{0}", rVal); MessageBox.Show(Err, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); textBoxStatus.Text = latestPrinterStatus.ToString(); } EnableControls(); }
private void checkBoxEnableHeadPower_CheckedChanged(object sender, EventArgs e) { if (inSetHeadPower) { return; } inSetHeadPower = true; if (status.Connected) { eRET rVal = PrinterInterfaceCLS.PiSetHeadPower(checkBoxEnableHeadPower.Checked ? 1 : 0); if (rVal != eRET.RVAL_OK) { MessageBox.Show("PiSetHeadPower failed with " + rVal.ToString() + "\n\nPlease check that all PCC cards are connected and have completed initialisation", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); checkBoxEnableHeadPower.Checked = false; } else { // Prevent further PiSetHeadPower commands being sent until the status reports HeadPowerIdle checkBoxEnableHeadPower.Enabled = false; } } inSetHeadPower = false; }
/// <summary> /// Check whether any of the PCCs in the system are in the process of turning head /// power on or off. Should only be called when all required PCCs are connected. /// Sets the value of HeadPowerIdle. /// </summary> private void CheckHeadPowerIdle() { for (int pccNum = 1; pccNum <= PccsRequired; pccNum++) { TAppPccStatus pccStatus; eRET rVal = PrinterInterfaceCLS.PiGetPccStatus(pccNum, out pccStatus); if (rVal != eRET.RVAL_OK) { HeadPowerIdle = false; return; } if ((pccStatus.bmStatusBits2 & Bmps.BMPS2_HEAD_POWER_IN_PROGRESS) != 0) { HeadPowerIdle = false; return; } } HeadPowerIdle = true; }