Esempio n. 1
0
 public int CreateLayout(string LayoutFileName, Control rootPanel)
 {
     int height = 0;
     List<Control> controlList = new List<Control>();
     XmlReaderSettings settings = new XmlReaderSettings {
         IgnoreComments = true,
         IgnoreWhitespace = true
     };
     XmlReader xReader = null;
     try
     {
         xReader = XmlReader.Create(LayoutFileName, settings);
         rootPanel.SuspendLayout();
         bool flag = false;
         while (xReader.Read())
         {
             if ((xReader.NodeType == XmlNodeType.Element) & (xReader.LocalName == "layout"))
             {
                 flag = true;
                 if (xReader.GetAttribute("UseDefaultSize") == "True")
                 {
                     Size size = new Size(xReader.GetAttribute("Size"));
                     height = size.Height;
                 }
             }
             else if (flag)
             {
                 this.doCreateLayout(xReader, controlList);
             }
         }
     }
     catch (XmlException exception)
     {
         NaccsException exception2 = new NaccsException(MessageKind.Error, 0x1f8, exception.Message);
         throw exception2;
     }
     catch (Exception exception3)
     {
         NaccsException exception4 = new NaccsException(MessageKind.Error, 510, exception3.Message);
         throw exception4;
     }
     finally
     {
         rootPanel.Controls.AddRange(controlList.ToArray());
         rootPanel.ResumeLayout(true);
         if (xReader != null)
         {
             xReader.Close();
         }
     }
     return height;
 }
Esempio n. 2
0
        public void setNextLocation(int itemWedth)
        {
            switch (this.developKind)
            {
                case "s":
                    this.x = (this.x + itemWedth) + 6;
                    return;

                case "r":
                    this.x = (this.x + itemWedth) + 2;
                    return;
            }
            NaccsException exception = new NaccsException(MessageKind.Error, 0x3e7, "Print classification error");
            throw exception;
        }
Esempio n. 3
0
 public CharsWidth(string fontStr)
 {
     string[] strArray = fontStr.Split(new char[] { ',' });
     this.fontFamily = strArray[0];
     string s = strArray[1];
     s = s.Trim(new char[] { ' ', 'p', 't' });
     try
     {
         this.fontSize = int.Parse(s);
     }
     catch (Exception)
     {
         NaccsException exception = new NaccsException(MessageKind.Error, 0x3e7, fontStr);
         throw exception;
     }
     this.font = new Font(this.fontFamily, (float) this.fontSize);
     this.printer = new PrinterSettings();
     this.grfx = this.printer.CreateMeasurementGraphics();
 }
Esempio n. 4
0
        public Location(string developKind)
        {
            this.developKind = "";
            this.developKind = developKind;
            switch (this.developKind)
            {
                case "s":
                    this.x = 20;
                    this.y = 20;
                    return;

                case "r":
                    this.x = 2;
                    this.y = 20;
                    return;
            }
            NaccsException exception = new NaccsException(MessageKind.Error, 0x3e7, "Print classification error");
            throw exception;
        }
Esempio n. 5
0
 private void ResultReceived()
 {
     if (((this.mPrintMode != PrintStatus.Print) || ((this.mPrintMode == PrintStatus.Print) && (this.mPrintFlg == 0))) && ((Control) this.mSender).InvokeRequired)
     {
         ReceivedDelegate method = new ReceivedDelegate(this.ResultReceived);
         ((Control) this.mSender).Invoke(method, new object[0]);
     }
     else
     {
         try
         {
             if (this.mPrintMode == PrintStatus.DataviewPrint)
             {
                 Naccs.Common.Print.Print prt = new Naccs.Common.Print.Print {
                     PrintKey = this.mKey
                 };
                 this.PrinterSetting(prt);
                 prt.OnPrintEnd += new OnPrintEndEventHandler(this.PRT_OnPrintEnd);
                 prt.OwnerSender = this.mSender;
                 prt.printDataView(this.mData.Items, this.mPreviewFlg);
             }
             else
             {
                 Naccs.Common.Print.Print print2 = new Naccs.Common.Print.Print {
                     PrintDlgMode = this.mPrintFlg,
                     PrintKey = this.mKey,
                     TimeStamp = this.mData.TimeStamp
                 };
                 if (this.mData.Header.InputInfo.Trim().Length > 0)
                 {
                     print2.InputInfo = this.mData.Header.InputInfo;
                 }
                 if (this.mData.Header.ServerRecvTime.Trim().Length > 0)
                 {
                     print2.ServerRecvTime = this.mData.Header.ServerRecvTime.Replace(' ', '0');
                 }
                 if (this.mData.Contained == ContainedType.ReceiveOnly)
                 {
                     print2.Contained = 2;
                 }
                 else if (this.mData.Contained == ContainedType.SendOnly)
                 {
                     print2.Contained = 1;
                 }
                 else
                 {
                     print2.Contained = 0;
                 }
                 PathInfo info = PathInfo.CreateInstance();
                 print2.FontFilePath = info.SystemEnvironmentPath;
                 print2.ImportFontFiles = info.SystemEnvironmentPath + @"\NACCS_OCR.TTF";
                 print2.OcrFontName = "NACCS_OCR";
                 print2.OcrFontSize = 12f;
                 this.PrinterSetting(print2);
                 GStampSettings settings = GStampSettings.CreateInstance();
                 print2.IsWriteGStamp = settings.GStampInfo.GStampOn;
                 List<string> list = new List<string> {
                     settings.GStampInfo.TopItem,
                     settings.GStampInfo.DateItem,
                     settings.GStampInfo.UnderItem1,
                     settings.GStampInfo.UnderItem2,
                     settings.GStampInfo.UnderItem3
                 };
                 print2.GStampInfo = CommaText.ItemsToCommaText(list);
                 print2.GStampDateAlign = settings.GStampInfo.DateAlignment;
                 print2.OnPrintEnd += new OnPrintEndEventHandler(this.PRT_OnPrintEnd);
                 print2.CustomTemplatePath = this.mCustomTemplatePath;
                 SystemEnvironment environment = SystemEnvironment.CreateInstance();
                 print2.StampMarkText = environment.TerminalInfo.PrintStampMark;
                 print2.OwnerSender = this.mSender;
                 if (this.mJobConfig == null)
                 {
                     print2.execTextPrint(this.mData.Items, this.mPreviewFlg);
                 }
                 else if (this.mData.Style == JobStyle.combi)
                 {
                     this.mData.JobIndex = 1;
                     print2.printTemplate(this.mJobConfig, this.mData.SubItems, this.mPreviewFlg);
                 }
                 else
                 {
                     print2.printTemplate(this.mJobConfig, this.mData.Items, this.mPreviewFlg);
                 }
             }
         }
         catch (NaccsException exception)
         {
             this.OnThPrintError(exception, this.mKey, this.mPrintFlg);
         }
         catch (Exception exception2)
         {
             NaccsException sender = new NaccsException(Naccs.Common.MessageKind.Error, 0x261, exception2.Message);
             this.OnThPrintError(sender, this.mKey, this.mPrintFlg);
         }
     }
 }
Esempio n. 6
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);
             }
         }
     }
 }
Esempio n. 7
0
 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);
             }
         }
     }
 }
Esempio n. 8
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);
         }
     }
 }
Esempio n. 9
0
 public void HardCopyPrinting(object Sender, bool PreviewFlg)
 {
     try
     {
         this.SettingsRead();
         HrdCopy copy = new HrdCopy();
         Form form = (Form) Sender;
         form.TopMost = true;
         form.Refresh();
         Bitmap bitmapimg = copy.Capture(new Rectangle(form.Location, form.Size));
         form.TopMost = false;
         PrintSetups setups = PrintSetups.CreateInstance();
         PrinterSettings settings = this.PrinterSetting(setups.DefaultInfo.Printer, setups.DefaultInfo.BinNo);
         if (settings == null)
         {
             throw new NaccsException(Naccs.Common.MessageKind.Error, 0x25f, Resources.ResourceManager.GetString("CORE76"));
         }
         copy.PrinterSettings = settings;
         copy.Print(bitmapimg, Sender, PreviewFlg);
     }
     catch (NaccsException exception)
     {
         this.PrintErrMsg(exception);
     }
     catch (Exception exception2)
     {
         NaccsException naccsException = new NaccsException(Naccs.Common.MessageKind.Error, 0x261, MessageDialog.CreateExceptionMessage(exception2));
         this.PrintErrMsg(naccsException);
     }
 }
Esempio n. 10
0
 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);
             }
         }
     }
 }