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

SetupEpubControl() private method

private SetupEpubControl ( ) : void
return void
        private void SetupEpubControl()
        {
            Cursor =Cursors.WaitCursor;
            if (_epubPreviewControl == null)
            {
                _epubPreviewControl = new EpubView();
                _epubPreviewBrowser = new Browser();
                _epubPreviewBrowser.Isolator = _isolator;
                _epubPreviewBrowser.Dock = DockStyle.Fill;
                _epubPreviewControl.Controls.Add(_epubPreviewBrowser);
                // Has to be in front of the panel docked top for Fill to work.
                _epubPreviewBrowser.BringToFront();
            }
            _epubPreviewControl.SetBounds(_pdfViewer.Left, _pdfViewer.Top,
                _pdfViewer.Width, _pdfViewer.Height);
            _epubPreviewControl.Dock = _pdfViewer.Dock;
            _epubPreviewControl.Anchor = _pdfViewer.Anchor;
            var saveBackGround = _epubPreviewControl.BackColor; // changed to match parent during next statement
            Controls.Add(_epubPreviewControl);
            _epubPreviewControl.BackColor = saveBackGround; // keep own color.
            // Typically this control is dock.fill. It has to be in front of tableLayoutPanel1 (which is Left) for Fill to work.
            _epubPreviewControl.BringToFront();

            _model.PrepareToStageEpub();
            if (!_publishWithoutAudio && !LameEncoder.IsAvailable() && _model.IsCompressedAudioMissing)
            {
                var fileLocator = _model.BookSelection.CurrentSelection.GetFileLocator();
                var englishMissingLameModulePath = fileLocator.LocateFileWithThrow("ePUB" + Path.DirectorySeparatorChar + "MissingLameModule-en.html");
                // I hesitate to change the definition of BloomFileLocator.BrowserRoot to return absolute paths.  But apparently we need to feed
                // _epubPreviewBrowser an absolute path or it mysteriously tries to open the relative path in an actual browser window, not itself.
                // (See http://issues.bloomlibrary.org/youtrack/issue/BL-3906 if you don't believe this, which I don't except I see it happening.)
                // So ensure that our file path is an absolute filepath.
                var baseFolder = FileLocator.DirectoryOfApplicationOrSolution;
                if (!englishMissingLameModulePath.StartsWith(baseFolder))
                    englishMissingLameModulePath = Path.Combine(baseFolder, englishMissingLameModulePath);
                var localizedMissingLameModulePath = BloomFileLocator.GetBestLocalizedFile(englishMissingLameModulePath);
                _epubPreviewBrowser.Navigate(localizedMissingLameModulePath, false);
                _epubPreviewBrowser.OnBrowserClick += (sender, e) =>
                {
                    var element = (GeckoHtmlElement)(e as DomEventArgs).Target.CastToGeckoElement();
                    if (element.GetAttribute("id") == "proceedWithoutAudio")
                    {
                        _publishWithoutAudio = true;
                        SetupEpubControlContent();
                    }
                };
            }
            else
            {
                SetupEpubControlContent();
            }
            Cursor = Cursors.Default;
        }