Ejemplo n.º 1
0
        public ActionResult OpenWithArchitect(List <string> files)
        {
            var architectPath = _pdfArchitectCheck.GetInstallationPath();

            Logger.Debug("Open with PDF Architect");

            if (_pdfArchitectCheck.IsInstalled())
            {
                try
                {
                    foreach (var file in files)
                    {
                        _processStarter.Start(architectPath, "\"" + file + "\"");
                        Logger.Trace("Openend: " + file);
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error(ex, "PDF Architect could not open file(s):\r\n" + string.Join("\r\n", files));
                    return(new ActionResult(ErrorCode.Viewer_ArchitectCouldNotOpenOutput));
                }
            }
            else
            {
                _recommendArchitectAssistant.Show();
            }

            return(new ActionResult());
        }
        public void CreateViewModel_CheckPDFArchitectIsInstalled_PDFArchitectInstalledCheckedIsCalled()
        {
            var viewModel = BuildArchitectViewModel();

            _pdfArchitectCheck.IsInstalled().Returns(true);
            Assert.IsTrue(viewModel.IsPdfArchitectInstalled);

            _pdfArchitectCheck.IsInstalled().Returns(false);
            Assert.IsFalse(viewModel.IsPdfArchitectInstalled);
        }
        public void ProcessJob_WithPdf_NoArchitect_OpensFile()
        {
            var filePath = @"X:\SomeFile\test.pdf";

            _job.OutputFiles.Add(filePath);
            _fileAssoc.HasOpen(".pdf").Returns(true);
            _pdfArchitectCheck.IsInstalled().Returns(false);

            var result = _defaultViewerAction.ProcessJob(_job);

            Assert.IsTrue(result.IsSuccess);
            _processStarter.Received(1).Start(filePath);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Open all files in the default viewer
        /// </summary>
        /// <param name="job">Job information</param>
        /// <returns>An ActionResult to determine the success and a list of errors</returns>
        public ActionResult ProcessJob(Job job)
        {
            Logger.Debug("Launched Viewer-Action");

            var file = job.OutputFiles.First();

            var isPdf = job.Profile.OutputFormat.IsPdf();

            if (isPdf && job.Profile.OpenWithPdfArchitect && _pdfArchitectCheck.IsInstalled())
            {
                return(OpenWithArchitect(file));
            }

            return(OpenOutputFile(file));
        }
        private void OpenWithArchictectExecute(object obj)
        {
            if (!CurrentProfile.OpenWithPdfArchitect)
            {
                return;
            }

            if (_pdfArchitectCheck.IsInstalled())
            {
                return;
            }

            const string caption = "PDF Architect";
            var          message = Translator.GetTranslation("OpenViewerSettings", "ArchitectNotInstalled");

            var interaction = new MessageInteraction(message, caption, MessageOptions.YesNo, MessageIcon.PDFForge);

            _interactionInvoker.Invoke(interaction);

            if (interaction.Response == MessageResponse.Yes)
            {
                _processStarter.Start(Urls.ArchitectDownloadUrl);
            }

            CurrentProfile.OpenWithPdfArchitect = false;
            RaisePropertyChanged(nameof(CurrentProfile));
        }
        public override void Execute(object obj)
        {
            if (_architectCheck.IsInstalled())
            {
                var files = GetPaths(obj);

                string          architectPath = _architectCheck.GetInstallationPath();
                FileVersionInfo info          = FileVersionInfo.GetVersionInfo(architectPath);
                var             version       = new Version(info.ProductVersion);

                if (version >= MinimumArchitectPrintDialogVersion)
                {
                    foreach (var file in files)
                    {
                        PrintWithArchitect(file);
                    }
                }
                else
                {
                    _recommendArchitectUpgrade.Show();
                }
            }
            else
            {
                _recommendArchitectAssistant.Show();
            }
        }
Ejemplo n.º 7
0
        protected override bool StartApplication()
        {
            _logger.Debug("Starting main window");
            _mainWindowThreadLauncher.LaunchMainWindow();

            var pdfArchitectCheckThread = new SynchronizedThread(() => { _pdfArchitectCheck.IsInstalled(); });

            _threadManager.StartSynchronizedThread(pdfArchitectCheckThread);

            return(true);
        }
        public override void Execute(object obj)
        {
            var files = GetPaths(obj);

            if (_architectCheck.IsInstalled())
            {
                foreach (var file in files)
                {
                    _action.OpenWithArchitect(file);
                }
            }
            else
            {
                _recommendArchitect.Show();
            }
        }
Ejemplo n.º 9
0
 private bool IsArchitectInstalled()
 {
     return(_architectCheck.IsInstalled());
 }