I'm implementing a print feature in a UWP app, and I cannot find any nice way to cancel the print task after clicking Print on the preview page. Our users may be printing dozens or even hundreds of pages at a time, which takes awhile to send to the printer, so having a cancel option is very important.
The user's workflow is:
Select some pages to print
Configure some custom print options
Show the Print UI with the preview (PrintManager.ShowPrintUIAsync())
Click print
Show a progress bar/status while the job is being sent to the printer. This can take awhile, so a cancel option needs to be available here.
I'm following the print sample: https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/Printing I cannot find any way to cancel in PrintManager, PrintTask, PrintTaskRequest, AddPagesEventArgs, PrintTaskProgressingEventArgs, etc.
My only idea is to use a CancellationTokenSource and throw if cancellation is requested, but this seems like a hacky workaround. Am I missing something?