Bloom.Edit.EditingView.UpdateSingleDisplayedPage C# (CSharp) Method

UpdateSingleDisplayedPage() public method

public UpdateSingleDisplayedPage ( IPage page ) : void
page IPage
return void
        public void UpdateSingleDisplayedPage(IPage page)
        {
            if(!_model.Visible)
            {
                return;
            }

            if(_model.HaveCurrentEditableBook)
            {
            #if MEMORYCHECK
            // Check memory for the benefit of developers.
                SIL.Windows.Forms.Reporting.MemoryManagement.CheckMemory(true, "EditingView - about to change the page", false);
            #endif
                _pageListView.SelectThumbnailWithoutSendingEvent(page);
                _model.SetupServerWithCurrentPageIframeContents();
                HtmlDom domForCurrentPage = _model.GetXmlDocumentForCurrentPage();
                var dom = _model.GetXmlDocumentForEditScreenWebPage();
                _model.RemoveStandardEventListeners();
                _browser1.Navigate(dom, domForCurrentPage, setAsCurrentPageForDebugging: true);
                _model.CheckForBL2364("navigated to page");
                _pageListView.Focus();
                // So far, the most reliable way I've found to detect that the page is fully loaded and we can call
                // initialize() is the ReadyStateChanged event (combined with checking that ReadyState is "complete").
                // This works for most pages but not all...some (e.g., the credits page in a basic book) seem to just go on
                // being "interactive". As a desperate step I tried looking for DocumentCompleted (which fires too soon and often),
                // but still, we never get one where the ready state is completed. This page just stays 'interactive'.
                // A desperate expedient would be to try running some Javascript to test whether the 'initialize' function
                // has actually loaded. If you try that, be careful...this function seems to be used in cases where that
                // never happens.
                _browser1.WebBrowser.DocumentCompleted += WebBrowser_ReadyStateChanged;
                _browser1.WebBrowser.ReadyStateChange += WebBrowser_ReadyStateChanged;
            #if __MonoCS__
                // On Linux/Mono, the user can click between pages too fast in Edit mode, resulting
                // in a warning dialog popping up.  I've never seen this happen on Windows, but it's
                // happening fairly often on Linux when I just try to move around a book.  The fix
                // here is to set a flag that page selection is still processing and block any
                // further page selecting until the current page has finished loading.
                _model.PageSelectionStarted();
                _browser1.WebBrowser.DocumentCompleted += WebBrowser_DocumentCompleted;
            #endif
            }
            UpdateDisplay();
        }

Usage Example

コード例 #1
0
        public void SetLayout(Layout layout)
        {
            SaveNow();
            CurrentBook.SetLayout(layout);
            CurrentBook.PrepareForEditing();
            _view.UpdateSingleDisplayedPage(_pageSelection.CurrentSelection);

            _view.UpdatePageList(true);            //counting on this to redo the thumbnails
        }