Exemple #1
0
        public async Task Load_CapacityFitsSavedHistory_HistoryInHistoryManagerWasLoadedFromHistoryStorage()
        {
            _settings.ApplicationSettings.JobHistory.Capacity = _storedHistoryFullCapacity.Count;

            await _jobHistoryManager.Load();

            Assert.AreEqual(_storedHistoryFullCapacity, _jobHistoryManager.History);
        }
        public void Load_CapacityFitsSavedHistory_HistoryInHistoryManagerWasLoadedFromHistoryStorage()
        {
            _settings.ApplicationSettings.JobHistory.Capacity = _storedHistory.Count;

            _jobHistoryManager.Load();
            var loadedHistory = _jobHistoryManager.History;

            Assert.AreEqual(_storedHistory, loadedHistory);
        }
        public bool SendMessageOrStartApplication(Func <string> composePipeMessage, Func <bool> startApplication, bool startManagePrintJobs)
        {
            _settingsManager.LoadAllSettings();
            Task.Run(() => _jobHistoryManager.Load());

            var pipeMessage = composePipeMessage();

            var retry   = 0;
            var success = false;

            // Make n Attempts: Look if a pipe server exists, if so, send a message. If that fails, retry (and maybe do the job yourself)
            while (!success && (retry++ < Retries))
            {
                _logger.Debug("Starting attempt {0}: ", retry);
                if (_pipeServerManager.IsServerRunning())
                {
                    success = TrySendPipeMessage(pipeMessage);
                    _logger.Debug("TrySendPipeMessage: " + success);
                }
                else
                {
                    success = TryStartApplication(startApplication, startManagePrintJobs);
                    _logger.Debug("TryStartApplication: " + success);
                }
            }

            if (success)
            {
                _logger.Debug("Starting update check thread");
                StartUpdateCheck();

                _logger.Debug("Starting Cleanup thread");
                StartCleanUpThread();
            }

            Shutdown();
            return(success);
        }