Exemple #1
0
 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);
             }
         }
     }
 }
Exemple #2
0
 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);
         }
     }
 }