public void SetDisplayMode(PublishModel.DisplayModes displayMode)
{
if (displayMode != PublishModel.DisplayModes.Upload && _publishControl != null)
{
Controls.Remove(_publishControl);
_publishControl = null;
}
if (displayMode != PublishModel.DisplayModes.EPUB && _epubPreviewControl != null && Controls.Contains(_epubPreviewControl))
{
Controls.Remove(_epubPreviewControl);
}
if (displayMode != PublishModel.DisplayModes.Upload && displayMode != PublishModel.DisplayModes.EPUB)
_pdfViewer.Visible = true;
switch (displayMode)
{
case PublishModel.DisplayModes.WaitForUserToChooseSomething:
_printButton.Enabled = _saveButton.Enabled = false;
Cursor = Cursors.Default;
_workingIndicator.Visible = false;
_pdfViewer.Visible = false;
break;
case PublishModel.DisplayModes.Working:
_printButton.Enabled = _saveButton.Enabled = false;
_workingIndicator.Cursor = Cursors.WaitCursor;
Cursor = Cursors.WaitCursor;
_workingIndicator.Visible = true;
break;
case PublishModel.DisplayModes.ShowPdf:
if (RobustFile.Exists(_model.PdfFilePath))
{
_pdfViewer.Visible = true;
_workingIndicator.Visible = false;
Cursor = Cursors.Default;
_saveButton.Enabled = true;
_printButton.Enabled = _pdfViewer.ShowPdf(_model.PdfFilePath);
}
break;
case PublishModel.DisplayModes.Printing:
_simpleAllPagesRadio.Enabled = false;
_bookletCoverRadio.Enabled = false;
_bookletBodyRadio.Enabled = false;
_printButton.Enabled = _saveButton.Enabled = false;
_workingIndicator.Cursor = Cursors.WaitCursor;
Cursor = Cursors.WaitCursor;
_workingIndicator.Visible = true;
break;
case PublishModel.DisplayModes.ResumeAfterPrint:
_simpleAllPagesRadio.Enabled = true;
_pdfViewer.Visible = true;
_workingIndicator.Visible = false;
Cursor = Cursors.Default;
_saveButton.Enabled = true;
_printButton.Enabled = true;
break;
case PublishModel.DisplayModes.Upload:
{
_workingIndicator.Visible = false; // If we haven't finished creating the PDF, we will indicate that in the progress window.
_saveButton.Enabled = _printButton.Enabled = false; // Can't print or save in this mode...wouldn't be obvious what would be saved.
_pdfViewer.Visible = false;
Cursor = Cursors.Default;
if (_publishControl == null)
{
SetupPublishControl();
}
break;
}
case PublishModel.DisplayModes.EPUB:
{
// We may reuse this for the process of generating the ePUB staging files. For now, skip it.
_workingIndicator.Visible = false;
_printButton.Enabled = false; // don't know how to print an ePUB
_saveButton.Enabled = true; // lets us save it to an actual ePUB
_pdfViewer.Visible = false;
Cursor = Cursors.Default;
SetupEpubControl();
break;
}
}
UpdateSaveButton();
}