/// <summary> /// Appends an item to the end of the JobInfo Queue /// </summary> /// <param name="jobInfo">The JobInfo to add</param> public void Add(IJobInfo jobInfo) { var jobFile = Path.GetFullPath(jobInfo.InfFile); _logger.Debug("New JobInfo: " + jobFile); _logger.Debug("DocumentTitle: " + jobInfo.SourceFiles[0].DocumentTitle); _logger.Debug("ClientComputer: " + jobInfo.SourceFiles[0].ClientComputer); _logger.Debug("SessionId: " + jobInfo.SourceFiles[0].SessionId); _logger.Debug("PrinterName: " + jobInfo.SourceFiles[0].PrinterName); _logger.Debug("JobCounter: " + jobInfo.SourceFiles[0].JobCounter); _logger.Debug("JobId: " + jobInfo.SourceFiles[0].JobId); if (_jobFileSet.Contains(jobFile)) { return; } _logger.Debug("Added JobInfo: " + jobFile); JobInfos.Add(jobInfo); _jobFileSet.Add(jobFile); if (OnNewJobInfo != null) { OnNewJobInfo(null, new NewJobInfoEventArgs(jobInfo)); } }
public DesignTimeJobInfoQueue() { JobInfos.Add(new JobInfo { PrintDateTime = DateTime.Now, Metadata = new Metadata { PrintJobName = "Print Job 1" }, SourceFiles = new ObservableCollection <SourceFileInfo> { new SourceFileInfo() { DocumentTitle = "Print Job 1", TotalPages = 4, JobCounter = 1 } } }); JobInfos.Add(new JobInfo { PrintDateTime = DateTime.Now, Metadata = new Metadata { PrintJobName = "Print Job 2" }, SourceFiles = new ObservableCollection <SourceFileInfo> { new SourceFileInfo() { DocumentTitle = "Print Job 2", TotalPages = 2, JobCounter = 2 } } }); }
private void MoveJob(IJobInfo jobInfo, int positionDifference) { var oldIndex = _jobInfos.IndexOf(jobInfo); _jobInfos.Move(oldIndex, oldIndex + positionDifference); JobInfos.MoveCurrentToPosition(oldIndex + positionDifference); }
private void MoveJob(JobInfo jobInfo, int positionDifference) { var oldIndex = _jobInfos.IndexOf(jobInfo); var newIndex = oldIndex + positionDifference; _jobInfos.Move(oldIndex, newIndex); JobInfos.MoveCurrentTo(jobInfo); }
private void AddJobInfo(IJobInfo jobInfo) { _jobInfos.Add(jobInfo); if (JobInfos.CurrentItem == null) { JobInfos.MoveCurrentToFirst(); } RaiseRefreshView(); }
/// <summary> /// Removes a JobInfo from the Queue /// </summary> /// <param name="jobInfo">The JobInfo to remove</param> /// <param name="deleteFiles">If true, the inf and source files will be deleted</param> /// <returns>true, if successful</returns> public bool Remove(IJobInfo jobInfo, bool deleteFiles) { _jobFileSet.Remove(jobInfo.InfFile); if (deleteFiles) { jobInfo.Delete(true); } return(JobInfos.Remove(jobInfo)); }
private void RaiseRefreshView(bool refreshCollectionView) { DeleteJobCommand.RaiseCanExecuteChanged(); MergeJobsCommand.RaiseCanExecuteChanged(); MergeAllJobsCommand.RaiseCanExecuteChanged(); if (refreshCollectionView) { JobInfos.Refresh(); } }
private void AddJobInfo(JobInfo jobInfo) { _synchronizedJobs.SuspendUpdates(); _jobInfos.Add(jobInfo); _synchronizedJobs.ResumeUpdates(); if (JobInfos.CurrentItem == null) { JobInfos.MoveCurrentToFirst(); } RaiseRefreshView(); }
private void ExecuteDeleteJob(object o) { var jobInfo = o as JobInfo; var position = JobInfos.CurrentPosition; _jobInfos.Remove(jobInfo); _jobInfoQueue.Remove(jobInfo, true); if (_jobInfos.Count > 0) { JobInfos.MoveCurrentToPosition(Math.Max(0, position - 1)); } RaiseRefreshView(); }
private void ExecuteDeleteJob(object o) { var jobs = o as IEnumerable <object>; if (jobs == null) { return; } foreach (var job in jobs.ToArray()) { var jobInfo = (IJobInfo)job; var position = JobInfos.CurrentPosition; _jobInfos.Remove(jobInfo); _jobInfoQueue.Remove(jobInfo, true); if (_jobInfos.Count > 0) { JobInfos.MoveCurrentToPosition(Math.Max(0, position - 1)); } } RaiseRefreshView(); }