コード例 #1
0
        public void PipeServerCannotBeStarted_RetriesStartApplication()
        {
            _pipeServerManager.StartServer().Returns(false);

            var starter = BuildMaybePipedApplicationStarter(2);

            starter.SendMessageOrStartApplication(() => "", () => false, false);

            _pipeServerManager.Received(2).StartServer();
        }
コード例 #2
0
        public void Initialize()
        {
            Logger.Trace("COM: Starting initialization process");

            _isComActive = true;

            if (IsServerInstanceRunning)
            {
                throw new InvalidOperationException("Access forbidden. An instance of PDFCreator is currently running.");
            }

            JobInfoQueue.OnNewJobInfo += (sender, eventArgs) => OnNewJob();

            Logger.Trace("COM: Starting pipe server thread");
            _pipeServerManager.StartServer();
        }
コード例 #3
0
        private bool TryStartApplication(Func <bool> startApplication, bool startManagePrintJobs)
        {
            var success = false;

            try
            {
                _logger.Debug("Starting pipe server");

                success = _pipeServerManager.StartServer();

                if (!success)
                {
                    return(false);
                }

                _logger.Debug("Reloading settings");
                // Settings may have changed as this may have not been the only instance till now
                _settingsManager.LoadAllSettings();

                if (startManagePrintJobs)
                {
                    _jobInfoQueueManager.ManagePrintJobs();
                }

                _logger.Debug("Finding spooled jobs");

                var spooledJobs = _spooledJobFinder.GetJobs();
                _jobInfoQueue.Add(spooledJobs);

                success = startApplication();
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "There was an error while starting the application");
                success = false;
                throw;
            }
            finally
            {
                if (!success)
                {
                    _pipeServerManager.Shutdown();
                }
            }
            return(success);
        }
コード例 #4
0
ファイル: QueueAdapter.cs プロジェクト: sm2x/PDFCreator
        public void Initialize()
        {
            Logger.Trace("COM: Starting initialization process");

            _isComActive = true;

            var startupCheck = _startupConditionChecker.CheckStartupConditions();

            if (!startupCheck.Item1)
            {
                throw new InvalidOperationException("Can't initialize the COM interface! " + startupCheck.Item2);
            }

            if (IsServerInstanceRunning)
            {
                throw new InvalidOperationException("Access forbidden. An instance of PDFCreator is currently running.");
            }

            JobInfoQueue.OnNewJobInfo += (sender, eventArgs) => OnNewJob();

            Logger.Trace("COM: Starting pipe server thread");
            _pipeServerManager.StartServer();
        }