private void PrintThreadFunction() { while (true) { try { KeyValue pair; lock (this) { while (m_Queue.Count == 0) { Monitor.Wait(this, TIMEOUT); } pair = (KeyValue)m_Queue[0]; m_Queue.RemoveAt(0); Debug.WriteLine(m_Queue.Count, "PrintJobs"); } string printerName = pair.Key; string docName = pair.Value1; string docText = pair.Value2; #if ENCODE string encText = pair.ToString().Encrypt(PASS); lock (typeof(PrinterQueue)) { if (!string.IsNullOrEmpty(CacheDirectory)) { File.WriteAllText(Path.Combine(CacheDirectory, string.Concat(docName, ".vol")), encText); } } #endif if (!DirectHelper.SendStringToPrinter(printerName, docName, docText)) { m_Queue.Insert(0, new KeyValue(printerName, docName, docText)); Thread.Sleep(ERRTIMEOUT); } } catch (Exception ex) { if (Error != null) { Error(this, new ThreadExceptionEventArgs(ex)); } } finally { Thread.Sleep(0); } } }
public void czech_print_format_TypeX_2() { var str = MTPL.NumToString("0A313233FF"); var str2 = MTPL.NumToString("32323232", 10); //Oki var docText1 = Helper.ToChr(27, 16, 65, 8, 3, 0, 1, 2, 1, 1, 1, 2, 30, 31, 32, 33, 34, 35, 36, 37) + ASCII.LF + ASCII.FF; var docText2 = string.Format(@"{0}it1r1s0x70y00b{1}\\", (char)27, 123456789) + ASCII.LF + ASCII.FF; var docText3 = MTPL.PrintI2Of5Barcode("123456789", 10, "000") + ASCII.FF; var docText4 = MTPL.NumToString("494E5445534C45415645442032204F4620350A0D1B10410803000102010101021B10420A313233343536373839300FFF"); var docText5 = ASCII.ESC + "it130r1s0x00y170b123456789012?+12345\\" + ASCII.LF + ASCII.FF; var docText6 = ASCII.ESC + "ih10w10x25y230lSample\\" + ASCII.LF + ASCII.ESC + "ix90y230s4h10w10f2g2e" + ASCII.LF + ASCII.ESC + "ix105y230s4h10w10v" + ASCII.LF + ASCII.FF; var docText7 = MTPL.PrintUSPSBarcode("123445") + ASCII.LF + ASCII.FF; var docText8 = MTPL.NumToString("271666101234567890") + ASCII.LF + ASCII.FF; var docText9 = MTPL.NumToString("1B 10 42 0A 31 32 33 34 35 36 37 38 39 30") + ASCII.LF + ASCII.FF; DirectHelper.SendStringToPrinter(Printers.Tally_T2365_2T, "test", docText9); }