public bool TestPrintOrder() { Double id = printOrder.id; pd = new PrintDocument(); this.setPageSize(); Model.PrintRe printRe = new Model.PrintRe(); printRe.id = id; try { Pixel = pd.DefaultPageSettings.PrinterResolution.X; // 获取分辨率 pd.PrintPage += pd_PrintPage; pd.PrintController = new StandardPrintController(); //去掉打印弹出框 pd.Print(); printRe.code = 0; new Utils.Notification().Open("打印通知", "打印完成"); printRe.msg = "打印成功"; } catch (Exception ex) { printRe.code = 1; printRe.msg = ex.Message; MyLogService.Error("解析打印指令出错", ex); new Utils.Notification().Open("打印通知", "解析打印指令出错"); return(false); } finally { this.msg = DynamicJson.Serialize(printRe); MyLogService.Print(this.msg); } return(true); }
public bool SetPrintOrder(string printOrder) { try { new Utils.Notification().Open("打印通知", "已接到打印指令,正在打印"); this.printOrder = DynamicJson.Parse(printOrder); MyLogService.Print(printOrder); return(true); } catch (Exception ex) { this.msg = ex.Message; MyLogService.Error("反序列化打印指令出错", ex); new Utils.Notification().Open("打印通知", "反序列化打印指令出错"); return(false); } }