private void QueueThreadStart(PQRecAttr rec) { if (this.ThreadPrintingFlg) { this.PrintQ.Enqueue(rec); } else { this.ThreadPrintingFlg = true; try { AbstractJobConfig config; this.GetJobConfig(rec.Data, out config); if (this.mCombi) { rec.Data.Style = JobStyle.combi; rec.Data.JobIndex = 1; } PrintThread thread = new PrintThread(); thread.OnThPrintEnd += new OnThPrintEndHandler(this.PrintManager_OnPrintEnd); thread.OnThPrintError += new OnThPrintErrorHandler(this.PrintManager_OnPrintError); string customTempPath = this.GetCustomTempPath(rec.Data, config); if (customTempPath.Length > 0) { string defaultPattern = this.GetDefaultPattern(rec.Data, customTempPath); if (defaultPattern.Length > 0) { thread.CustomTemplatePath = customTempPath.Trim(new char[] { '\\' }) + @"\" + defaultPattern; } } thread.TmThreadPrint(PrintStatus.Print, this.mSender, rec.Key, rec.PrintFlg, config, rec.Data, false); } catch (NaccsException exception) { if (this.OnPrintError != null) { this.PrintError(exception, rec.Key, rec.PrintFlg); } else { this.PrintErrMsg(exception); } } catch (Exception exception2) { NaccsException sender = new NaccsException(Naccs.Common.MessageKind.Error, 0x261, exception2.Message); if (this.OnPrintError != null) { this.PrintError(sender, rec.Key, rec.PrintFlg); } else { this.PrintErrMsg(sender); } } } }
public void Printing(object Sender, string Key, IData Data, int PrintFlg, bool PreviewFlg) { if (PrintFlg == 0) { if (this.mManualFlg) { return; } this.mManualFlg = true; } this.mSender = Sender; this.SettingsRead(); if ((PrintFlg != 2) || this.IsAutomaticPrint(Data)) { int length = Data.Header.Length; if (length <= 400) { length = Data.CalcLength(); } if (PrintFlg == 0) { if (ConfigFiles.printerSettings.DefaultInfo.SizeWarning && (length > this.mBorderByte)) { string str; if (!PreviewFlg) { str = "W601"; } else { str = "W602"; } IMessageDialog dialog = new MessageDialog(); if (dialog.ShowMessage(str, Math.Truncate((double) (((double) this.mBorderByte) / 1024.0)).ToString(), "") != DialogResult.Yes) { this.mManualFlg = false; return; } } try { AbstractJobConfig config; this.GetJobConfig(Data, out config); if (this.mCombi) { Data.Style = JobStyle.combi; Data.JobIndex = 1; } PrintThread thread = new PrintThread(); thread.OnThPrintEnd += new OnThPrintEndHandler(this.PrintManager_OnPrintEnd); thread.OnThPrintError += new OnThPrintErrorHandler(this.PrintManager_OnPrintError); thread.TmThreadPrint(PrintStatus.Print, Sender, Key, PrintFlg, config, Data, PreviewFlg); } catch (NaccsException exception) { this.mManualFlg = false; if (this.OnPrintError != null) { this.OnPrintError(exception, Key, PrintFlg); } else { this.PrintErrMsg(exception); } } catch (Exception exception2) { this.mManualFlg = false; NaccsException sender = new NaccsException(Naccs.Common.MessageKind.Error, 0x261, exception2.Message); if (this.OnPrintError != null) { this.OnPrintError(sender, Key, PrintFlg); } else { this.PrintErrMsg(sender); } } } else if (!ConfigFiles.printerSettings.DefaultInfo.SizeWarning || (length <= this.mBorderByte)) { PQRecAttr rec = new PQRecAttr { Key = Key, Data = (NaccsData) Data, PrintFlg = PrintFlg }; this.QueueThreadStart(rec); } } }
private void QueueThreadEnd() { if (this.PrintQ.Count == 0) { this.ThreadPrintingFlg = false; } else { PQRecAttr attr = (PQRecAttr) this.PrintQ.Dequeue(); this.ThreadPrintingFlg = true; try { AbstractJobConfig config; this.GetJobConfig(attr.Data, out config); PrintThread thread = new PrintThread(); thread.OnThPrintEnd += new OnThPrintEndHandler(this.PrintManager_OnPrintEnd); thread.OnThPrintError += new OnThPrintErrorHandler(this.PrintManager_OnPrintError); string customTempPath = this.GetCustomTempPath(attr.Data, config); if (customTempPath.Length > 0) { string defaultPattern = this.GetDefaultPattern(attr.Data, customTempPath); if (defaultPattern.Length > 0) { thread.CustomTemplatePath = customTempPath.Trim(new char[] { '\\' }) + @"\" + defaultPattern; } } thread.TmThreadPrint(PrintStatus.Print, this.mSender, attr.Key, attr.PrintFlg, config, attr.Data, false); } catch (NaccsException exception) { if (this.OnPrintError != null) { this.PrintError(exception, attr.Key, attr.PrintFlg); } else { this.PrintErrMsg(exception); } } catch (Exception exception2) { NaccsException sender = new NaccsException(Naccs.Common.MessageKind.Error, 0x261, exception2.Message); if (this.OnPrintError != null) { this.PrintError(sender, attr.Key, attr.PrintFlg); } else { this.PrintErrMsg(sender); } } } }
public void DataviewPrint(object Sender, IData Data, bool PreviewFlg) { if (!this.mManualFlg) { this.mManualFlg = true; this.mSender = Sender; this.SettingsRead(); try { PrintThread thread = new PrintThread(); thread.OnThPrintEnd += new OnThPrintEndHandler(this.PrintManager_OnPrintEnd); thread.OnThPrintError += new OnThPrintErrorHandler(this.PrintManager_OnPrintError); thread.TmThreadPrint(PrintStatus.DataviewPrint, Sender, "", 0, null, Data, PreviewFlg); } catch (NaccsException exception) { this.mManualFlg = false; if (this.OnPrintError != null) { this.OnPrintError(exception, "", 0); } else { this.PrintErrMsg(exception); } } catch (Exception exception2) { this.mManualFlg = false; NaccsException sender = new NaccsException(Naccs.Common.MessageKind.Error, 0x261, MessageDialog.CreateExceptionMessage(exception2)); if (this.OnPrintError != null) { this.OnPrintError(sender, "", 0); } else { this.PrintErrMsg(sender); } } } }