static void WarningHandler(object source, LinePrinter.WarningMessageArgs Error) { string temp; DialogResult result; temp = string.Format( "{0} from {1} Printer \n\r\n\r Fix problem and continue printing?", GetErrorStr(Error.ErrorCode),Error.DeviceType); result = MessageBox.Show(temp, "PRINTER WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == DialogResult.No) lp.Cancel(); }
This routine works as follows: If a PR2/PR3 or NPCP printer generates a warning (such as "out of paper") during a print job, a message box appears asking if you want to fix the problem and continue the report. If you respond No, the application calls the Cancel method, telling the LinePrinter that you want to cancel the report. The warning is promoted to an error and an exception is invoked.
This step concludes the Tutorial. At this point, you should use the Wireless Printing applet in the control panel of the mobile computer to establish a Bluetooth connection from your mobile computer to the printer.
After you establish the Bluetooth connection to the printer, you should be able to compile and run the sample. You should be able to see any warnings or errors generated by the print job.
Next » Print Routine Overview
Back » Tutorial Part 5