public void MakeBooklet()
{
if (IsMakingPdf)
{
// Can't start again until this one finishes
return;
}
_model.PdfGenerationSucceeded = false; // and so it stays unless we generate it successfully.
if (_uploadRadio.Checked)
{
// We aren't going to display it, so don't bother generating it unless the user actually uploads.
// Unfortunately, the completion of the generation process is normally responsible for putting us into
// the right display mode for what we generated (or failed to), after this routine puts us into the
// mode that shows generation is pending. For the upload button case, we want to go straight to the Upload
// mode, so the upload control appears. This is a bizarre place to do it, but I can't find a better one.
SetDisplayMode(PublishModel.DisplayModes.Upload);
return;
}
if (_epubRadio.Checked)
{
// We aren't going to display it, so don't bother generating it.
// Unfortunately, the completion of the generation process is normally responsible for putting us into
// the right display mode for what we generated (or failed to), after this routine puts us into the
// mode that shows generation is pending. For the ePUB button case, we want to go straight to the ePUB preview.
SetDisplayMode(PublishModel.DisplayModes.EPUB);
return;
}
SetDisplayMode(PublishModel.DisplayModes.Working);
_makePdfBackgroundWorker.RunWorkerAsync();
}