public PublishView(PublishModel model,
SelectedTabChangedEvent selectedTabChangedEvent, LocalizationChangedEvent localizationChangedEvent, BookTransfer bookTransferrer, LoginDialog login, NavigationIsolator isolator)
{
_bookTransferrer = bookTransferrer;
_loginDialog = login;
_isolator = isolator;
InitializeComponent();
if (this.DesignMode)
return;
_model = model;
_model.View = this;
_makePdfBackgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(_makePdfBackgroundWorker_RunWorkerCompleted);
_pdfViewer.PrintProgress += new System.EventHandler<PdfPrintProgressEventArgs>(OnPrintProgress);
// BL-625: With mono, if a RadioButton group has its AutoCheck properties set to true, the default RadioButton.OnEnter
// event checks to make sure one of the RadioButtons is checked. If none are checked, the one the mouse pointer
// is over is checked, causing the CheckChanged event to fire.
if (SIL.PlatformUtilities.Platform.IsMono)
SetAutoCheck(false);
//NB: just triggering off "VisibilityChanged" was unreliable. So now we trigger
//off the tab itself changing, either to us or away from us.
selectedTabChangedEvent.Subscribe(c=>
{
if (c.To == this)
{
Activate();
}
else if (c.To!=this && IsMakingPdf)
_makePdfBackgroundWorker.CancelAsync();
});
//TODO: find a way to call this just once, at the right time:
// DeskAnalytics.Track("Publish");
//#if DEBUG
// var linkLabel = new LinkLabel() {Text = "DEBUG"};
// linkLabel.Click+=new EventHandler((x,y)=>_model.DebugCurrentPDFLayout());
// tableLayoutPanel1.Controls.Add(linkLabel);
//#endif
if (SIL.PlatformUtilities.Platform.IsMono)
{
BackgroundColorsForLinux();
}
// Adding this renderer prevents a white line from showing up under the components.
_menusToolStrip.Renderer = new EditingView.FixedToolStripRenderer();
GeckoPreferences.Default["pdfjs.disabled"] = false;
SetupLocalization();
localizationChangedEvent.Subscribe(o =>
{
SetupLocalization();
UpdateLayoutChoiceLabels();
UpdateSaveButton();
});
// Make this extra box available to show when wanted.
_previewBox = new PictureBox();
_previewBox.Visible = false;
Controls.Add(_previewBox);
_previewBox.BringToFront();
}