/// <summary> /// Add a new printjob and check whether there were loading problems for earlier queued jobs /// </summary> /// <param name="html">The document we want to print as html source string</param> /// <returns>Were there any loading problems detected with earlier queued jobs? Note: loading takes a bit of time! Success or fail is not clear immediately.</returns> public bool AddPrintJob(string html) { bool loadingProblems = CleanUp(); //add the new job PrintSender ps = new PrintSender(); ps.Send(html, errortitlerecogniser, WaitForPrint); tasks.Enqueue(ps); return(loadingProblems); }
/// <summary> /// Clean up the queue and check for loading problems /// </summary> /// <returns>Were there any loading problems in documents returned from the queue?</returns> private bool CleanUp() { bool loadingproblems = false; //none detected yet while (tasks.Any() && tasks.Peek().disposable) { PrintSender job = tasks.Dequeue(); if (job.loadingFailed) { loadingproblems = true; } job.Dispose(); } return(loadingproblems); }