예제 #1
0
        /// <summary>
        /// called after we've safely navigated the browser to about:blank
        /// to avoid the situation where we try to over-write but can't
        /// </summary>
        private void ContinueConversionAndNavigation()
        {
            if (IsAlreadyOpenElsewhere(_incomingPath))
            {
                ErrorReport.NotifyUserOfProblem("That file appears to be open. First close it, then try again.");
            }

            _pathToCurrentlyDisplayedPdf = Path.Combine(Path.GetTempPath(),
                                                        Path.GetFileNameWithoutExtension(_incomingPath) +
                                                        "-booklet.pdf");
            //                _pathToCurrentlyDisplayedPdf = Path.Combine(Path.GetDirectoryName(_incomingPath), Path.GetFileNameWithoutExtension(_incomingPath) + "-booklet.pdf");

            if (!DeleteFileThatMayBeInUse(_pathToCurrentlyDisplayedPdf))
            {
                ErrorReport.NotifyUserOfProblem("For some reason that file is stuck... please try that again.");
            }


            try
            {
                SelectedMethod.Layout(_inputPdf, _incomingPath, _pathToCurrentlyDisplayedPdf, PaperTarget, Settings.Default.RightToLeft, Settings.Default.ShowCropMarks);
                _view.Navigate(_pathToCurrentlyDisplayedPdf);
            }
            catch (Exception error)
            {
                ErrorReport.NotifyUserOfProblem(error, "PdfBooklet was unable to convert that file.");
            }
            _view.UpdateDisplay();
        }