using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace EQUIPINTERFACETEST
{
    public class Print
    {
        public static void PrintBarCode(string barcode)
        {
            string xmlPath = "../../XMLResources/Biaopi.xml";
            BarcodeLib.BarCodeGenerate generate = new BarcodeLib.BarCodeGenerate();
            generate.PrintBarCode(barcode, xmlPath);
        }

        public static void CreateBarCodeFile(string barcode)
        {
            BarcodeLib.BarCodeModel barCodeModel = new BarcodeLib.BarCodeModel();
            BarcodeLib.BarCodeGenerate g = new BarcodeLib.BarCodeGenerate(@"D:\项目文件夹\FJC_CC_B9\truck\B9\ServicesCenter\WCF\EQUIPINTERFACETEST\Biaopi.xml");
            //b = g.Generate2DBarCode(this.txtData.Text, "E:\\条码打印\\Barcode_src\\BarcodeLibTest\\Biaopi.xml");
            barCodeModel = g.GenerateBarCode(barcode);

            Image imageObj=barCodeModel.Img;

            imageObj.Save(string.Format(@"D:\项目文件夹\FJC_CC_B9\truck\B9\ServicesCenter\WCF\EQUIPINTERFACETEST\BarCodeFile\{0}.jpeg", barcode));

        }

        public static void Test()
        {
            List<string> barcodeList = new List<string>();
            barcodeList.Add("16061215432AH1A02");
            barcodeList.Add("16062303311AB1A06");

            //BarCodePrintClient printClient = new BarCodePrintClient();
            //printClient.Print(barcodeList.ToArray(), "BP");

            //return;
            //string[] barCode = barcodeList.ToArray();
            //for (int i = 0; i < barCode.Length; i++)
            //{
            //    try
            //    {
            //        QM.Assist.LabelInfo ll = new QM.Assist.LabelInfo();
            //        string item = barCode[i].Trim();
            //        string hb = item.Substring(12, 1);
            //        ll.BarCode = item + ",*" + item + "*" + "," + (hb == "H" ? "高" : "");

            //        QM.Assist.PrintUtil.LabelList2.Add(ll);
            //    }
            //    catch (Exception ex)
            //    {

            //        WriteLog.Write(ex.Message);
            //    }

            //}

            //QM.Assist.PrintUtil pu = new QM.Assist.PrintUtil();

            //string proPath = @"C:\Program Files\lmw32\Lmwprint.exe";//System.Configuration.ConfigurationManager.AppSettings["proPath"].ToString();
            //string temPath = @"D:\打印模板\tangsu.qdf";// System.Configuration.ConfigurationManager.AppSettings["temPath"].ToString();
            //string dataPath = @"D:\打印模板\tangsu.txt";// System.Configuration.ConfigurationManager.AppSettings["dataPath"].ToString();

            //pu.PrintLabel2(proPath, temPath, dataPath);
        
        }
    }
}