Esempio n. 1
0
        //重置打印码,将原来的print_code设为未用,并选择新的print_code设为已用
        public void resetPrintCode()
        {
            string new_code = HttpTool.sendPost(RESET_PRINTER_CODE_URL, "uid=" + uid);

            Properties.Settings.Default.print_code = new_code;
            ImageTool.logLog("print_code=" + new_code);
            Properties.Settings.Default.Save();
        }
        string uid; // 全球唯一标示符

        #endregion Fields

        #region Constructors

        // WxPrinter的构造方法
        public WxPrinter(HomeForm homeForm,string sUid)
        {
            myHomeForm = homeForm;
            myPrintServer = new PrintService(this);
            myImageTool = new ImageTool(this);
            uid = sUid;

            // 向服务器注册当前打印机
            string code = HttpTool.sendPost(ADD_PRINTER_UID_URL, "uid=" + uid);
            Properties.Settings.Default.print_code = code;
            Properties.Settings.Default.Save();
        }
Esempio n. 3
0
        string uid;                     // 全球唯一标示符

        // WxPrinter的构造方法
        public WxPrinter(HomeForm homeForm, string sUid)
        {
            myHomeForm    = homeForm;
            myPrintServer = new PrintService(this);
            myImageTool   = new ImageTool(this);
            uid           = sUid;

            // 向服务器注册当前打印机
            string code = HttpTool.sendPost(ADD_PRINTER_UID_URL, "uid=" + uid);

            Properties.Settings.Default.print_code = code;
            Properties.Settings.Default.Save();
        }
Esempio n. 4
0
        //---------- image_tool api ----------
        //监测到了新的照片的处理
        public void rcvdNewImage(string imgUrl)
        {
            isPrinting = true;

            //定义下载的文件名称和路径
            string filePath = System.Windows.Forms.Application.UserAppDataPath + "/down_image.why";

            //1.下载
            ImageTool.DownloadFile(imgUrl, filePath);

            //2.展示
            setShowImage(filePath);

            //3.打印
            myPrintServer.printImage(filePath);

            //4.事后
            myHomeForm.resetPrintCode();
        }
Esempio n. 5
0
        PrintService myPrintServer; //打印用的工具包

        #endregion Fields

        #region Constructors

        // WxPrinter的构造方法
        public WxPrinter(HomeForm homeForm)
        {
            myHomeForm = homeForm;
            myPrintServer = new PrintService(this);
            myImageTool = new ImageTool(this);
        }