Bloom.Publish.PublishView._makePdfBackgroundWorker_RunWorkerCompleted C# (CSharp) Method

_makePdfBackgroundWorker_RunWorkerCompleted() private method

private _makePdfBackgroundWorker_RunWorkerCompleted ( object sender, System e ) : void
sender object
e System
return void
        void _makePdfBackgroundWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            _model.PdfGenerationSucceeded = false;
            if (!e.Cancelled)
            {
                if (e.Result is Exception)
                {
                    var error = e.Result as Exception;
                    if (error is ApplicationException)
                    {
                        //For common exceptions, we catch them earlier (in the worker thread) and give a more helpful message
                        //note, we don't want to include the original, as it leads to people sending in reports we don't
                        //actually want to see. E.g., we don't want a bug report just because they didn't have Acrobat
                        //installed, or they had the PDF open in Word, or something like that.
                        ErrorReport.NotifyUserOfProblem(error.Message);
                    }
                    else if (error is FileNotFoundException && ((FileNotFoundException) error).FileName == "BloomPdfMaker.exe")
                    {
                        ErrorReport.NotifyUserOfProblem(error, error.Message);
                    }
                    else // for others, just give a generic message and include the original exception in the message
                    {
                        ErrorReport.NotifyUserOfProblem(error, "Sorry, Bloom had a problem creating the PDF.");
                    }
                    UpdateDisplayMode();
                    return;
                }
                _model.PdfGenerationSucceeded = true;
                    // should be the only place this is set, when we generated successfully.
                UpdateDisplayMode();
            }
            if(e.Cancelled || _model.BookletPortion != (PublishModel.BookletPortions) e.Result )
            {
                MakeBooklet();
            }
        }