Esempio n. 1
0
        private void _okButton_Click(object sender, EventArgs e)
        {
            this.DocumentFileName    = _documentLocationTextBox.Text.Trim();
            this.FirstPageNumber     = _firstPageNumber;
            this.LastPageNumber      = _lastPageNumber;
            this.LoadAttachmentsMode = (DocumentLoadAttachmentsMode)_attachmentsModeComboBox.SelectedIndex;

            if (_noAnnotationsRadioButton.Checked)
            {
                this.AnnotationsFileName     = null;
                this.LoadEmbeddedAnnotations = false;
                this.RenderAnnotations       = false;
            }
            else if (_renderAnnotationsRadioButton.Checked)
            {
                this.AnnotationsFileName     = null;
                this.LoadEmbeddedAnnotations = true;
                this.RenderAnnotations       = true;
            }
            else if (_embeddedAnnotationsRadioButton.Checked)
            {
                this.AnnotationsFileName     = null;
                this.LoadEmbeddedAnnotations = true;
                this.RenderAnnotations       = false;
            }
            else
            {
                this.AnnotationsFileName     = _annotationsLocationTextBox.Text.Trim();
                this.LoadEmbeddedAnnotations = false;
                this.RenderAnnotations       = false;
            }
        }
        private void _loadButton_Click(object sender, EventArgs e)
        {
            Uri documentUri;
            var options = new LoadDocumentAsyncOptions();

            // Get the URI
            try
            {
                documentUri = new Uri(_documentLocationTextBox.Text.Trim());

                if (_noAnnotationsRadioButton.Checked)
                {
                    options.AnnotationsUri          = null;
                    options.LoadEmbeddedAnnotations = false;
                    options.RenderAnnotations       = false;
                }
                else if (_renderAnnotationsRadioButton.Checked)
                {
                    options.AnnotationsUri          = null;
                    options.LoadEmbeddedAnnotations = true;
                    options.RenderAnnotations       = true;
                }
                else if (_embeddedAnnotationsRadioButton.Checked)
                {
                    options.AnnotationsUri          = null;
                    options.LoadEmbeddedAnnotations = true;
                    options.RenderAnnotations       = false;
                }
                else
                {
                    options.AnnotationsUri          = new Uri(_annotationsLocationTextBox.Text.Trim());
                    options.LoadEmbeddedAnnotations = false;
                    options.RenderAnnotations       = false;
                }
            }
            catch (Exception ex)
            {
                Helper.ShowError(this, ex);
                return;
            }

            this.FirstPageNumber     = _firstPageNumber;
            this.LastPageNumber      = _lastPageNumber;
            this.LoadAttachmentsMode = (DocumentLoadAttachmentsMode)_attachmentsModeComboBox.SelectedIndex;

            options.FirstPageNumber     = this.FirstPageNumber;
            options.LastPageNumber      = this.LastPageNumber;
            options.LoadAttachmentsMode = this.LoadAttachmentsMode;

            _isCancelPending = false;
            _isLoading       = false;
            var mainForm = this.Owner as MainForm;

            if (mainForm.LoadDocumentFromUri(this, documentUri, options))
            {
                // Means the main form has started loading the document
                _isLoading = true;
                _documentLocationGroupBox.Enabled = false;
                _annotationsGroupBox.Enabled      = false;
                _progressBar.Visible = true;
            }
        }