public MainWindow() { InitializeComponent(); lbJobs.ItemsSource = _jobs; foreach (var job in CoreFactory.ConfigurationService.GetJobs()) { var uiJob = new UIJob() { Config = job, Icon = UICanvasIcon.Init }; _jobs.Add(uiJob); } BackgroundWorker backgroundWorker = new BackgroundWorker { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; backgroundWorker.DoWork += BackgroundWorkerOnDoWork; backgroundWorker.ProgressChanged += BackgroundWorkerCycleUpdate; backgroundWorker.RunWorkerAsync(); }
public InkCounterForm(UIJob jobInfo) { InitializeComponent(); workJob = jobInfo; clolorsLabels = new List <Label>() { label1, label2, label3, label4, label5, label6, label7, label8 }; clolorsInk = new List <Label>() { label9, label10, label11, label12, label13, label14, label15, label16 }; clolorsInkMl = new List <Label>() { label17, label18, label19, label20, label21, label22, label23, label24 }; worker = new BackgroundWorker(); worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); worker.WorkerSupportsCancellation = true; worker.WorkerReportsProgress = true; worker.RunWorkerAsync(); buttonStart.Enabled = false; }
public void UpdateUIJobPreview(UIJob job) { if (job != null) { string path = ""; if (job.IsClipOrTile) { path = PubFunc.GetFullPreviewPath(job.TilePreViewFile); } else { path = PubFunc.GetFullPreviewPath(job.PreViewFile); } UpdatePreviewImage(path); UpdateJobSizeInfo(job.JobSize); UpdateJobInfo(m_curUnit, job); } else { //No one job in joblist UpdatePreviewImage(""); UpdateJobSizeInfo(SizeF.Empty); UpdateJobInfo(m_curUnit, null); } m_curJob = job; }
public void UpdateUIJobPreview(UIJob job) { if (job != null) { m_curJob = job; string path = ""; if (job.IsClipOrTile) { m_PrintPreview.Rotate = RotateFlipType.RotateNoneFlipNone; path = PubFunc.GetFullPreviewPath(job.TilePreViewFile); } else { if (UIFunctionOnOff.PreviewRotate180) { m_PrintPreview.Rotate = RotateFlipType.Rotate180FlipNone; } path = PubFunc.GetFullPreviewPath(job.PreViewFile); } UpdatePreviewImage(path); UpdateJobSizeInfo(job.JobSize); UpdateJobInfo(m_curUnit, job); } else { //No one job in joblist UpdatePreviewImage(""); UpdateJobSizeInfo(SizeF.Empty); UpdateJobInfo(m_curUnit, null); } m_curJob = job; }
/// <summary> /// Add job to UI /// </summary> /// <param name="job"></param> public void add(Job job) { // Get row number int row = table.RowCount; // Creating new UI Job UIJob uiJob = new UIJob(job, row, items.Count); if (InvokeRequired) { Invoke(new addJobControlsCb(this.addJobControls), new object[] { uiJob }); } else { addJobControls(uiJob); } job.onChange += (object sender, Job evJob) => { if (InvokeRequired) { Invoke(new updateCb(this.update), new object[] { uiJob, evJob }); } else { update(uiJob, evJob); } }; items.Add(row, uiJob); }
public void UpdateUIJobPreview(UIJob job, Image img = null) { if (job != null) { if (img == null) { if (job.IsClipOrTile) { UpdatePreviewImage(PubFunc.GetFullPreviewPath(job.TilePreViewFile)); } else { UpdatePreviewImage(PubFunc.GetFullPreviewPath(job.PreViewFile)); } } else { UpdatePreviewImage(img); } UpdateJobSizeInfo(job.JobSize); UpdateJobInfo(m_curUnit, job); } else { //No one job in joblist UpdatePreviewImage(""); UpdateJobSizeInfo(SizeF.Empty); UpdateJobInfo(m_curUnit, null); } m_curJob = job; }
private void buttonOk_Click(object sender, System.EventArgs e) { try { if (this.m_PreviewJob.Clips.XCnt > 1 && !this.InvalidCheck()) { //this.tabControl_setting.SelectedIndex = 0; this.numericUpDownX.Focus(); return; } this.m_EditJob = this.m_PreviewJob.Clone(); if (this.m_EditJob.IsClipOrTile) { m_EditJob.TilePreViewFile = m_EditJob.GeneratePreviewName(true); if (this.m_image != null) { try { this.m_image.Save(PubFunc.GetFullPreviewPath(m_EditJob.TilePreViewFile)); m_image.Dispose(); } catch { } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } this.DialogResult = DialogResult.OK; }
public void RefreshSize(UIPreference m_Preference) { UIJob job = (UIJob)this.Tag; int IndexOfSize = m_Preference.IndexOf(JobListColumnHeader.Size); this.SubItems[IndexOfSize].Text = GetJobSize((float)job.ResolutionX, (float)job.ResolutionY, job.Dimension, m_Preference); this.ToolTipText = GetTooltipString(job, m_Preference); }
public JLRepeatBtn(UIJob job) : base() { this.uijob = job; Text = "Reprint"; Click += JLRepeatBtn_Click; Margin = new Padding(5); }
public static object SystemConvertFromXml(XmlElement printRecord, Type type) { PrintRecord record = new PrintRecord(); XmlNode currNode = printRecord.FirstChild; record.Job = (UIJob)UIJob.SystemConvertFromXml((XmlElement)currNode, typeof(UIJob)); currNode = currNode.NextSibling; if (currNode == null) { return(record); } record.innerInkCounts = (List <InnerInkCount>)PubFunc.SystemConvertFromXml(currNode.OuterXml, typeof(List <InnerInkCount>)); if (record.innerInkCounts != null) { foreach (var item in record.innerInkCounts) { record.InkCount[item.Color] = item.Value; } } currNode = currNode.NextSibling; if (currNode == null) { return(record); } record.AllCopiesTime = (long)PubFunc.SystemConvertFromXml(currNode.OuterXml, typeof(long)); currNode = currNode.NextSibling; if (currNode == null) { return(record); } record.PrintedLength = (float)PubFunc.SystemConvertFromXml(currNode.OuterXml, typeof(float)); currNode = currNode.NextSibling; if (currNode == null) { return(record); } record.PrintedArea = (float)PubFunc.SystemConvertFromXml(currNode.OuterXml, typeof(float)); currNode = currNode.NextSibling; if (currNode == null) { return(record); } record.FXOrigin = (float)PubFunc.SystemConvertFromXml(currNode.OuterXml, typeof(float)); currNode = currNode.NextSibling; if (currNode == null) { return(record); } record.FYOrigin = (float)PubFunc.SystemConvertFromXml(currNode.OuterXml, typeof(float)); currNode = currNode.NextSibling; if (currNode == null) { return(record); } record.PrintedTileCount = (int)PubFunc.SystemConvertFromXml(currNode.OuterXml, typeof(int)); return(record); }
/// <summary> /// 开始记录,主要是做了以下事情: /// 1、清除上一次打印记录缓存 /// 2、获取最新的墨量消耗,作为基准 /// </summary> /// <param name="job"></param> public void StartRecord(UIJob job) { printRecords.Clear(); inkCountBase.Clear(); foreach (var colorInk in GetUsedInk()) { inkCountBase[colorInk.Item1] = colorInk.Item2; } }
private void UpdateJobInfo(UILengthUnit unit, UIJob jobInfo) { InitNull(); if (jobInfo != null) { //float width = this.CalcRealJobWidth(unit,jobInfo.JobSize.Width); UpdateJobInfoText(unit, jobInfo.JobSize.Width, jobInfo.JobSize.Height, jobInfo.ResolutionX, jobInfo.ResolutionY, jobInfo.ColorDeep, jobInfo.PassNumber, jobInfo.PrintingDirection, jobInfo.FileLocation, jobInfo.LangID); } }
private void UpdateJobInfo(UILengthUnit unit, UIJob jobInfo) { if (jobInfo == null) { InitNull(); } else { float width = jobInfo.JobSize.Width; //PubFunc.CalcRealJobWidth(jobInfo.JobSize.Width,this.m_iPrinterChange.GetAllParam()); UpdateJobInfoText(unit, width, jobInfo.JobSize.Height, jobInfo.ResolutionX, jobInfo.ResolutionY, jobInfo.ColorDeep, jobInfo.PassNumber, jobInfo.PrintingDirection, jobInfo.FileLocation, jobInfo.LangID); } }
//public string ToolTipString = string.Empty; public string GetTooltipString(UIJob job, UIPreference options) { string newtip = string.Empty; bool bPrinted = job.Status == JobStatus.Printed; int colLen = options.JobListHeaderList.Length; for (int i = 0; i < colLen; i++) { JobListColumnHeader cur = (JobListColumnHeader)options.JobListHeaderList[i]; string cmode = ResString.GetEnumDisplayName(typeof(JobListColumnHeader), cur) + " : "; int index = options.IndexOf(cur); cmode += this.SubItems[index].Text; newtip += cmode + Environment.NewLine; } return(newtip); }
public void UpdateUIJobPreview(UIJob job) { if (job != null) { UpdatePreviewImage(job.Miniature); UpdateJobSizeInfo(job.JobSize); UpdateJobInfo(m_curUnit, job); } else { //No one job in joblist UpdatePreviewImage(null); UpdateJobSizeInfo(SizeF.Empty); UpdateJobInfo(m_curUnit, null); } m_curJob = job; }
private UIJob CreatJob(string fileName) { UIJob job = new UIJob(); job.Name = Path.GetFileName(fileName); job.PreViewFile = m_LastPreviewForlder + Path.GetFileNameWithoutExtension(fileName) + ".bmp"; job.Status = JobStatus.Idle; SPrtFileInfo jobInfo = new SPrtFileInfo(); Int32 bret = 0; bret = CoreInterface.Printer_GetFileInfo(fileName, ref jobInfo, 0); //if (bret == 1) { job.PrtFileInfo = jobInfo; job.FileLocation = fileName; } return(job); }
public JobFileReader(UIJob job, bool isAwbMode) { // // TODO: 在此处添加构造函数逻辑 // _workjob = job; _curPos = 0; _isDouble4CJob = job.sJobSetting.bIsDouble4CJob && isAwbMode; if (File.Exists(job.FileLocation)) { fileStream1 = new FileStream(job.FileLocation, FileMode.Open, FileAccess.Read, FileShare.Read); this.ReadInfoFromHeader(); fileStream1.Seek(0, SeekOrigin.Begin); } if (_isDouble4CJob && File.Exists(job.FileLocation2)) { fileStream2 = new FileStream(job.FileLocation2, FileMode.Open, FileAccess.Read, FileShare.Read); fileStream2.Seek(HEADERSIZE, SeekOrigin.Begin); } }
/// <summary> /// 统计墨量 /// 注:当前提供的接口只能获取到自第一次打印以来所消耗的各个颜色的墨量, /// 要计算某个作业消耗的墨量,只能是打印前和打印后各获取一次消耗的累计墨量,取两者的差值。 /// </summary> /// <param name="job"></param> /// <param name="PrintedCopy">本作业打印的份数</param> /// <param name="endPagePercent">最后一份打印的百分比</param> public void CalculateInk(UIJob job, float printedWidth, int PrintedCopy, int currentPrintPage, float endPagePercent, SPrinterSetting printerSetting) { PrintRecord printRecord = new PrintRecord(); printRecord.Job = job.Clone(); printRecord.AllCopiesTime = job.AllCopiesTime.Ticks; foreach (var colorInk in GetUsedInk()) { printRecord.InkCount[colorInk.Item1] = colorInk.Item2 - inkCountBase[colorInk.Item1]; } if (PrintedCopy == currentPrintPage) { printRecord.PrintedLength = UIPreference.ToDisplayLength(UILengthUnit.Meter, job.JobSize.Height) * (PrintedCopy - 1 + endPagePercent / 100.0f); } else { printRecord.PrintedLength = UIPreference.ToDisplayLength(UILengthUnit.Meter, job.JobSize.Height) * (PrintedCopy + endPagePercent / 100.0f); } if (job.IsClipOrTile) { int printedHeight = (int)(job.JobSize.Height * job.ResolutionY * endPagePercent / 100.0f + job.Clips.YDis); int printedcopy = PrintedCopy; if (PrintedCopy == currentPrintPage) { printedcopy = (PrintedCopy - 1); } printRecord.PrintedTileCount = printedcopy * job.Clips.XCnt * job.Clips.YCnt + ((printedHeight / (job.Clips.ClipRect.Height + job.Clips.YDis)) * job.Clips.XCnt); } else { printRecord.PrintedTileCount = PrintedCopy; } printRecord.PrintedArea = printedWidth * printRecord.PrintedLength; printRecord.FXOrigin = printerSetting.sFrequencySetting.fXOrigin; printRecord.FYOrigin = printerSetting.sBaseSetting.fYOrigin; printRecords.Add(printRecord); }
/// <summary> /// Add controls for job /// </summary> /// <param name="uiJob"></param> void addJobControls(UIJob uiJob) { table.RowCount++; table.RowStyles.Add(new RowStyle(SizeType.AutoSize)); int column = 0; table.Controls.Add(uiJob.repeatBtn, column++, uiJob.row); table.Controls.Add(uiJob.lIndex, column++, uiJob.row); table.Controls.Add(uiJob.lFile, column++, uiJob.row); table.Controls.Add(uiJob.lQuantity, column++, uiJob.row); table.Controls.Add(uiJob.lState, column++, uiJob.row); table.Controls.Add(uiJob.lProgress, column++, uiJob.row); table.Controls.Add(uiJob.lRecived, column++, uiJob.row); //table.Controls.Add(uiJob.lType, column++, uiJob.row); table.Controls.Add(uiJob.lDocument, column++, uiJob.row); table.Controls.Add(uiJob.lPrinter, column++, uiJob.row); //table.Controls.Add(uiJob.lUrl, column++, uiJob.row); updateTableWidth(); }
private UIJob CreatJob(string fileName) { UIJob job = new UIJob(); job.Name = Path.GetFileName(fileName); job.Status = JobStatus.Idle; SPrtFileInfo jobInfo = new SPrtFileInfo(); Int32 bret = 0; bret = CoreInterface.Printer_GetFileInfo(fileName, ref jobInfo, 0); //if (bret == 1) { job.PrtFileInfo = jobInfo; job.FileLocation = fileName; } job.TilePreViewFile = job.GeneratePreviewName(true); job.PreViewFile = job.GeneratePreviewName(false); return(job); }
public DoubleSidePrintForm(UIJob job, IPrinterChange iChange, bool useNewFunction) { InitializeComponent(); _useNewFunction = useNewFunction; _job = job; _printerChange = iChange; _adjustTimer = new Timer(); _adjustTimer.Interval = 1000; _adjustTimer.Tick += new EventHandler(_adjustTimer_Tick); #if DEBUG this.buttondebug.Visible = true; #else this.buttondebug.Visible = false; #endif UpdateViewByPrintingJob(true); OnJobStatusChanged(_job); label4.Visible = label3.Visible = numCursorPosX.Visible = numCursorPosY.Visible = _useNewFunction; label5.Visible = numFb.Visible = !_useNewFunction; }
/// <summary> /// Update job in UI /// </summary> /// <param name="uiJob"></param> /// <param name="job"></param> void update(UIJob uiJob, Job job) { uiJob.update(job); updateTableWidth(); }
public JobListItem(UIJob job, UIPreference options) { // // TODO: Add constructor logic here // bool bPrinted = job.Status == JobStatus.Printed; int headerLen = options.JobListHeaderList.Length; string [] items = new string[headerLen]; for (int i = 0; i < headerLen; i++) { items[i] = ""; } this.SubItems.AddRange(items); string passDispName = ResString.GetDisplayPass(); for (int i = 0; i < headerLen; i++) { JobListColumnHeader cur = (JobListColumnHeader)options.JobListHeaderList[i]; switch (cur) { case JobListColumnHeader.Name: this.SubItems[i].Text = job.Name; break; case JobListColumnHeader.Status: this.SubItems[i].Text = ResString.GetEnumDisplayName(typeof(JobStatus), job.Status); break; case JobListColumnHeader.Size: this.SubItems[i].Text = GetJobSize((float)job.ResolutionX, (float)job.ResolutionY, job.Dimension, options); break; case JobListColumnHeader.Resolution: this.SubItems[i].Text = job.ResolutionX.ToString() + "x" + job.ResolutionY.ToString(); break; case JobListColumnHeader.Passes: this.SubItems[i].Text = job.PassNumber.ToString() + " " + passDispName; break; case JobListColumnHeader.BiDirection: this.SubItems[i].Text = ResString.GetEnumDisplayName(typeof(PrintDirection), (PrintDirection)job.PrintingDirection); break; case JobListColumnHeader.Copies: this.SubItems[i].Text = job.Copies.ToString(); break; case JobListColumnHeader.PrintedPasses: this.SubItems[i].Text = job.PassNumber.ToString() + " " + passDispName; break; case JobListColumnHeader.PrintedDate: if (bPrinted) { string timeInfo = job.PrintedDate.ToString("u", DateTimeFormatInfo.InvariantInfo); int len = timeInfo.Length; if (len > 0 && !char.IsDigit(timeInfo, len - 1)) { timeInfo = timeInfo.Substring(0, len - 1); } this.SubItems[i].Text = timeInfo; } break; case JobListColumnHeader.Location: this.SubItems[i].Text = job.FileLocation; break; } } this.Tag = job; ToolTipText = GetTooltipString(job, options); if (bPrinted) { // this.ForeColor = Color.LightGray; this.Font = new Font(this.Font.FontFamily, this.Font.Size, FontStyle.Bold); } if (!File.Exists(job.FileLocation)) { this.ForeColor = Color.LightGray; this.Font = new Font(this.Font.FontFamily, this.Font.Size, FontStyle.Italic); } }
public void RefreshDis(UIJob job, UIPreference m_Preference, string strCopies) { JobStatus jobStatus = job.Status; int IndexOfStatus = m_Preference.IndexOf(JobListColumnHeader.Status); if (jobStatus == JobStatus.Printed) { if (IndexOfStatus > 0) { this.SubItems[IndexOfStatus].Text = ResString.GetEnumDisplayName(typeof(JobStatus), jobStatus); } job.PrintedDate = DateTime.Now; int IndexOfDate = m_Preference.IndexOf(JobListColumnHeader.PrintedDate); if (IndexOfDate > 0) { string timeInfo = job.PrintedDate.ToString("u", DateTimeFormatInfo.InvariantInfo); int len = timeInfo.Length; if (len > 0 && !char.IsDigit(timeInfo, len - 1)) { timeInfo = timeInfo.Substring(0, len - 1); } this.SubItems[IndexOfDate].Text = timeInfo; } int IndexOfTime = m_Preference.IndexOf(JobListColumnHeader.PrintTime); if (IndexOfTime > 0) { TimeSpan time = DateTime.Now - m_StartTime; m_AllCopesTime += time; string strTime = string.Empty; strTime = m_AllCopesTime.Hours.ToString() + ":" + m_AllCopesTime.Minutes.ToString() + ":" + m_AllCopesTime.Seconds.ToString(); this.SubItems[IndexOfTime].Text = strTime; // string strCopies = m_PrintJobTask.GetCopiesString(); if (strCopies != "") { string[] sss = strCopies.Split(new char[] { '/' }); if (sss.Length == 2 && int.Parse(sss[0]) == int.Parse(sss[1])) { m_AllCopesTime = TimeSpan.Zero; } } } #if false string passDispName = ResString.GetDisplayPass(); int IndexOfPass = m_Preference.IndexOf(JobListColumnHeader.PrintedPasses); this.SubItems[i].Text = job.PassNumber.ToString() + " " + passDispName; #endif // this.ForeColor = Color.LightGray; this.Font = new Font(this.Font.FontFamily, this.Font.Size, FontStyle.Bold); } else { //if(job != m_PrintJobTask.GetPrintingJob()) // { if (IndexOfStatus > 0) { if (jobStatus == JobStatus.Printing) { this.SubItems[(int)IndexOfStatus].Text = ResString.GetEnumDisplayName(typeof(JobStatus), jobStatus) + strCopies; } else { this.SubItems[(int)IndexOfStatus].Text = ResString.GetEnumDisplayName(typeof(JobStatus), jobStatus); } } // } } int copyIndex = m_Preference.IndexOf(JobListColumnHeader.Copies); if (copyIndex > 0) { this.SubItems[copyIndex].Text = job.Copies.ToString(); } int sizeIndex = m_Preference.IndexOf(JobListColumnHeader.Size); if (sizeIndex > 0) { this.SubItems[sizeIndex].Text = GetJobSize((float)job.ResolutionX, (float)job.ResolutionY, job.Dimension, m_Preference); } //更新ToolTip this.ToolTipText = GetTooltipString(job, m_Preference); }
public void OnJobStatusChanged(UIJob job) { }
private ListViewItem GetJTListViewItem(string[] subItems, UIJob job) { ListViewItem ret = new ListViewItem(job.Name, 0); for (int i = 0; i < subItems.Length; i++) { subItems[i] = ""; } ret.SubItems.AddRange(subItems); string passDispName = ResString.GetDisplayPass(); int j = 0; foreach (int i in Enum.GetValues(typeof(JobListColumnHeader))) { JobListColumnHeader cur = (JobListColumnHeader)i; switch (cur) { case JobListColumnHeader.Name: ret.SubItems[j].Text = job.Name; j++; break; //case JobListColumnHeader.Status: // this.SubItems[i].Text = ResString.GetEnumDisplayName(typeof(JobStatus), job.Status); // break; case JobListColumnHeader.Size: ret.SubItems[j].Text = GetJobSize((float)job.ResolutionX, (float)job.ResolutionY, job.Dimension); j++; break; case JobListColumnHeader.Resolution: ret.SubItems[j].Text = job.ResolutionX.ToString() + "x" + job.ResolutionY.ToString(); j++; break; case JobListColumnHeader.Passes: ret.SubItems[j].Text = job.PassNumber.ToString() + " " + passDispName; j++; break; case JobListColumnHeader.BiDirection: ret.SubItems[j].Text = ResString.GetEnumDisplayName(typeof(PrintDirection), (PrintDirection)job.PrintingDirection); j++; break; //case JobListColumnHeader.Copies: // this.SubItems[i].Text = job.Copies.ToString(); // break; //case JobListColumnHeader.PrintedPasses: // this.SubItems[i].Text = job.PassNumber.ToString() + " " + passDispName; // break; //case JobListColumnHeader.PrintedDate: // if (bPrinted) // { // string timeInfo = job.PrintedDate.ToString("u", DateTimeFormatInfo.InvariantInfo); // int len = timeInfo.Length; // if (len > 0 && !char.IsDigit(timeInfo, len - 1)) // timeInfo = timeInfo.Substring(0, len - 1); // this.SubItems[i].Text = timeInfo; // } // break; case JobListColumnHeader.Location: ret.SubItems[j].Text = job.FileLocation; j++; break; } } ret.Tag = job.FileLocation; return(ret); }