public void Clear() { while (JobInfoQueue.JobInfos.Count > 0) { JobInfoQueue.Remove(JobInfoQueue.JobInfos[0], true); } }
/// <summary> /// In case something went wrong, i.e. an exception was thrown, empties the whole queue. /// </summary> private void EmptyQueue() { while (_comJobInfoQueue.JobInfos.Count > 0) { _comJobInfoQueue.Remove(_comJobInfoQueue.JobInfos[0], true); } _comJobInfoQueue = null; }
public void DeleteJob(int index) { if (index < 0 || index >= Count) { throw new COMException("The given index was out of range."); } JobInfoQueue.Remove(JobInfoQueue.JobInfos[index], true); }
public void MergeAllJobs() { if (JobInfoQueue.Count == 0) { throw new COMException("The queue must not be empty."); } Logger.Trace("COM: Merging all ComJobs."); while (JobInfoQueue.Count > 1) { var firstJob = JobInfoQueue.JobInfos[0]; var nextJob = JobInfoQueue.JobInfos[1]; _jobInfoManager.Merge(firstJob, nextJob); JobInfoQueue.Remove(nextJob); } }
/// <summary> /// Initializes the essential components like JobInfoQueue for the COM object /// </summary> public void Initialize() { COMLogger.Trace("COM: Starting initialization process"); _comJobInfoQueue = JobInfoQueue.Instance; _comJobInfoQueue.OnNewJobInfo += (sender, eventArgs) => OnNewJob(); _isComActive = true; if (IsServerInstanceRunning) { throw new InvalidOperationException("Access forbidden. An instance of PDFCreator is currently running."); } LoggingHelper.InitFileLogger("PDFCreator", LoggingLevel.Error); SettingsHelper.Init(); COMLogger.Trace("COM: Starting pipe server thread"); ThreadManager.Instance.StartPipeServerThread(); }
public void MergeJobs(JobInfo job1, JobInfo job2) { Logger.Trace("COM: Merging two ComJobs."); _jobInfoManager.Merge(job1, job2); JobInfoQueue.Remove(job2); }