public void SetUp() { _job = new Job(new JobInfo(), new ConversionProfile(), new JobTranslations(), new Accounts()); _job.OutputFilenameTemplate = "MayNotStartWithTempfolder.pdf"; _job.OutputFiles.Add("NotEmpty.pdf"); _storedHistory = new List <HistoricJob>(); _jobHistoryStorage = Substitute.For <IJobHistoryStorage>(); for (var i = 0; i < _capacity; i++) { _storedHistory.Add(new HistoricJob(_job)); } _jobHistoryStorage.Load().Returns(_storedHistory); var settingsProvider = Substitute.For <ISettingsProvider>(); _settings = new PdfCreatorSettings(null); _settings.ApplicationSettings.JobHistory.Enabled = true; _settings.ApplicationSettings.JobHistory.Capacity = _capacity; settingsProvider.Settings.Returns(_settings); _tempFolderProvider = Substitute.For <ITempFolderProvider>(); _tempFolderProvider.TempFolder.Returns(TempFolder); _file = Substitute.For <IFile>(); _file.Exists(Arg.Any <string>()).Returns(true); _jobHistoryManager = new JobHistoryManager(settingsProvider, _jobHistoryStorage, _tempFolderProvider, _file); }
public JobInfoQueueManager(IManagePrintJobExceptionHandler managePrintJobExceptionHandler, IThreadManager threadManager, IWorkflowFactory workflowFactory, IJobInfoQueue jobInfoQueue, IJobBuilder jobBuilder, ISettingsProvider settingsProvider, IJobHistoryManager jobHistoryManager) { _managePrintJobExceptionHandler = managePrintJobExceptionHandler; _threadManager = threadManager; _workflowFactory = workflowFactory; _jobInfoQueue = jobInfoQueue; _jobBuilder = jobBuilder; _settingsProvider = settingsProvider; _jobHistoryManager = jobHistoryManager; _jobInfoQueue.OnNewJobInfo += JobInfoQueue_OnNewJobInfo; }
private MaybePipedApplicationStarter BuildMaybePipedApplicationStarter(int retries = 1) { _jobInfoQueueManager = Substitute.For <IJobInfoQueueManager>(); var jobInfoQueue = Substitute.For <IJobInfoQueue>(); var staticPropertiesHack = Substitute.For <IStaticPropertiesHack>(); var spooledJobFinder = Substitute.For <ISpooledJobFinder>(); _jobHistoryManager = Substitute.For <IJobHistoryManager>(); var starter = new MaybePipedApplicationStarter(_settingsManager, _updateAssistant, _startupConditions, _threadManager, _pipeServerManager, _jobInfoQueueManager, jobInfoQueue, staticPropertiesHack, _folderCleanUp, spooledJobFinder, _notificationService, _jobHistoryManager); starter.Retries = retries; return(starter); }
public MaybePipedApplicationStarter(ISettingsManager settingsManager, IUpdateAssistant updateAssistant, ICheckAllStartupConditions startupConditions, IThreadManager threadManager, IPipeServerManager pipeServerManager, IJobInfoQueueManager jobInfoQueueManager, IJobInfoQueue jobInfoQueue, IStaticPropertiesHack staticPropertiesHack, IPdfCreatorFolderCleanUp folderCleanUp, ISpooledJobFinder spooledJobFinder, INotificationService notificationService, IJobHistoryManager jobHistoryManager) { StartupConditions = startupConditions; _jobInfoQueue = jobInfoQueue; _folderCleanUp = folderCleanUp; _spooledJobFinder = spooledJobFinder; _notificationService = notificationService; _jobHistoryManager = jobHistoryManager; _settingsManager = settingsManager; _updateAssistant = updateAssistant; _threadManager = threadManager; _pipeServerManager = pipeServerManager; _jobInfoQueueManager = jobInfoQueueManager; staticPropertiesHack.SetStaticProperties(); }
public void SetUp() { _job = new Job(new JobInfo(), new ConversionProfile(), new JobTranslations(), new Accounts()); _job.OutputFilenameTemplate = "MayNotStartWithTempfolder.pdf"; _job.OutputFiles.Add("NotEmpty.pdf"); _storedHistoryFullCapacity = new List <HistoricJob>(); _jobHistoryStorage = Substitute.For <IJobHistoryStorage>(); _storedHistoryFullCapacity = new List <HistoricJob>(); var hjPdf = new HistoricFile(@"X:\Foldername\PeeDeeEff.pdf", "PeeDeeEff.pdf", @"X:\Foldername\", "ABC123"); var historicFiles = new List <HistoricFile> { hjPdf }; for (int i = 0; i < _capacity; i++) { _storedHistoryFullCapacity.Add(new HistoricJob(historicFiles, OutputFormat.Pdf, DateTime.Now, new Metadata(), 23, false)); } _jobHistoryStorage.Load().Returns(_storedHistoryFullCapacity); var settingsProvider = Substitute.For <ISettingsProvider>(); _settings = new PdfCreatorSettings(null); _settings.ApplicationSettings.JobHistory.Enabled = true; _settings.ApplicationSettings.JobHistory.Capacity = _capacity; settingsProvider.Settings.Returns(_settings); _tempFolderProvider = Substitute.For <ITempFolderProvider>(); _tempFolderProvider.TempFolder.Returns(TempFolder); _file = Substitute.For <IFile>(); _file.Exists(Arg.Any <string>()).Returns(true); _hashUtil = Substitute.For <IHashUtil>(); _jobHistoryManager = new JobHistoryManager(settingsProvider, _jobHistoryStorage, _tempFolderProvider, _file, _hashUtil); }
public HomeViewModel(IInteractionInvoker interactionInvoker, IFileConversionAssistant fileConversionAssistant, ITranslationUpdater translationUpdater, IPrinterHelper printerHelper, ISettingsProvider settingsProvider, IJobHistoryManager jobHistoryManager, IDispatcher dispatcher, ICommandLocator commandLocator) : base(translationUpdater) { _interactionInvoker = interactionInvoker; _fileConversionAssistant = fileConversionAssistant; _printerHelper = printerHelper; _settingsProvider = settingsProvider; JobHistory = CollectionViewSource.GetDefaultView(jobHistoryManager.History); jobHistoryManager.HistoryChanged += (sender, args) => { dispatcher.BeginInvoke(JobHistory.Refresh); RaisePropertyChanged(nameof(NumberOfHistoricJobs)); }; JobHistory.MoveCurrentTo(null); //unselect first item ConvertFileCommand = new DelegateCommand(o => ConvertFileExecute()); ClearHistoryCommand = new DelegateCommand(o => jobHistoryManager.Clear()); RefreshHistoryCommand = new DelegateCommand(o => jobHistoryManager.Refresh()); RemoveHistoricJobCommand = new DelegateCommand <HistoricJob>(jobHistoryManager.Remove); ToggleHistoryEnabledCommand = new DelegateCommand <HistoricJob>(hj => HistoryEnabled = !HistoryEnabled); DeleteHistoricFilesCommand = commandLocator.CreateMacroCommand() .AddCommand <DeleteHistoricFilesCommand>() .AddCommand(RefreshHistoryCommand) .Build(); StartQuickActionCommand = new DelegateCommand(StartQuickActionCommandExecute); QuickActionOpenList = new List <QuickActionListItemVo> { new QuickActionListItemVo(Translation.OpenPDFArchitect, commandLocator.GetCommand <QuickActionOpenWithPdfArchitectCommand>(), StartQuickActionCommand), new QuickActionListItemVo(Translation.OpenDefaultProgram, commandLocator.GetCommand <QuickActionOpenWithDefaultCommand>(), StartQuickActionCommand), new QuickActionListItemVo(Translation.OpenExplorer, commandLocator.GetCommand <QuickActionOpenExplorerLocationCommand>(), StartQuickActionCommand), new QuickActionListItemVo(Translation.OpenMailClient, commandLocator.GetCommand <QuickActionOpenMailClientCommand>(), StartQuickActionCommand) }; }