Exemple #1
0
        private void CleanUp()
        {
            _demoOptions.Save();

            _pagesControl.StopLoadingThumbnails();

            // Delete all resources
            if (_document != null)
            {
                _document.Dispose();
                _document = null;
            }

            _selectedText   = null;
            _findTextHelper = null;
            _documentText   = null;
        }
Exemple #2
0
        private void SetDocument(PDFDocument document, Dictionary <int, MyWord[]> documentText, string documentName)
        {
            this.SuspendLayout();

            try
            {
                // Stop the thumbnails generator if it is running
                _pagesControl.StopLoadingThumbnails();

                if (_document != null)
                {
                    _document.Dispose();
                    _document = null;
                }

                _documentText = null;

                _document = document;
                _documentAnnotations.SetDocument(document);

                if (_document != null)
                {
                    _selectedText   = new Dictionary <int, MyWord[]>();
                    _findTextHelper = new FindTextHelper();
                    _documentText   = new Dictionary <int, MyWord[]>();

                    for (int pageNumber = 1; pageNumber <= _document.Pages.Count; pageNumber++)
                    {
                        _selectedText.Add(pageNumber, null);
                        _documentText.Add(pageNumber, null);
                    }
                }
                else
                {
                    _selectedText   = null;
                    _findTextHelper = null;
                }

                _viewerControl.SetDocument(_document, _selectedText);
                _pagesControl.SetDocument(_document);

                if (_document != null)
                {
                    // Build words
                    _documentText = documentText;

                    _viewerControl.Visible = true;

                    if (_document.Pages.Count > 1)
                    {
                        _pagesControl.SetCurrentPageNumber(1);
                        _pagesControl.Visible = true;
                    }

                    Text = string.Format("{0} - {1}", documentName, Messager.Caption);

                    GotoPage(1, true);
                }
                else
                {
                    Text = Messager.Caption;
                }
            }
            finally
            {
                this.ResumeLayout();
            }
        }